You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Callback interfaces such as LoadTimeWeaverAware should allow for local overriding [SPR-13892] #18466
Trying to inject a custom LoadTimeWeaver into a LoadTimeWeaverAware fails, as it initially gets injected but then the LoadTimeWeaverAwareProcessor comes along and injects the default loadTimeWeaver.
This is so far by design: You can either populate such a setter manually or set up a context-wide reference, not both at the same time. If there is a context-wide LoadTimeWeaver to share, it actually takes precedence. This is the same for other *Aware interfaces.
In your case, you'd have to set up your "loadTimeWeaver" bean as your custom class manually, instead of using <context:load-time-weaver>.
Hm, I think it's a bit unfortunate.
I would consider the context-wide reference to be the default when there isn't a specific reference specified.
That would also work with the convention over configuration principle as well.
If I have a lot of beans using the default weaver and just one that needs a special weaver it means I have to manually set them all instead of just that one bean (in this case, a specific weaver for JPA) :(
And I don't even know what other infrastructure beans I might have that require the default weaver.
Activity
spring-projects-issues commentedon Apr 12, 2016
Juergen Hoeller commented
This is so far by design: You can either populate such a setter manually or set up a context-wide reference, not both at the same time. If there is a context-wide
LoadTimeWeaverto share, it actually takes precedence. This is the same for other*Awareinterfaces.In your case, you'd have to set up your "loadTimeWeaver" bean as your custom class manually, instead of using
<context:load-time-weaver>.spring-projects-issues commentedon Apr 12, 2016
Andrei Ivanov commented
Hm, I think it's a bit unfortunate.
I would consider the context-wide reference to be the default when there isn't a specific reference specified.
That would also work with the convention over configuration principle as well.
If I have a lot of beans using the default weaver and just one that needs a special weaver it means I have to manually set them all instead of just that one bean (in this case, a specific weaver for JPA) :(
And I don't even know what other infrastructure beans I might have that require the default weaver.
spring-projects-issues commentedon Apr 13, 2016
Andrei Ivanov commented
Any chance to turn this into a more generic improvement request regarding local overriding of injected properties by post-processors? :)
spring-projects-issues commentedon Jan 12, 2019
Bulk closing outdated, unresolved issues. Please, reopen if still relevant.