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
According to this section of Spring Framework Reference documentation, when autowire-candidate is set to false in a bean's XML definition, it excludes the bean from the autowiring infrastructure. The section doesn't talk about any exceptions to this case.
This works when, on the depending bean, autowire is set to byType. But when it is set to byName, the autowire-candidate="false" configuration of the target bean is ignored and it is still autowired.
This is an old design decision where autowire-candidate="false" only affects type-based autowiring attempts, not direct references by name... and not autowire="byName" either. While the latter may be debatable, I'm not inclined to change it at this point since autowire="byName" is an outdated mechanism to begin with. I'm therefore turning this into a documentation issue.
Senthil Kumar opened SPR-15072 and commented
According to this section of Spring Framework Reference documentation, when
autowire-candidate
is set tofalse
in a bean's XML definition, it excludes the bean from the autowiring infrastructure. The section doesn't talk about any exceptions to this case.This works when, on the depending bean,
autowire
is set tobyType
. But when it is set tobyName
, theautowire-candidate="false"
configuration of the target bean is ignored and it is still autowired.Affects: 4.3.5
Reference URL: spring-attic/spring-framework-issues#146
Referenced from: commits e8a082f, 8fc65ab
The text was updated successfully, but these errors were encountered: