-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Clarify @Bean(autowire=NO) [SPR-14282] #18854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Rob Winch commented I added a PR to the spring-framework-issues repository which demonstrates this issue. See spring-attic/spring-framework-issues#128 |
Juergen Hoeller commented I'm afraid this is by design: that autowire attribute just controls externally declared autowiring, analogous to XML bean definitions, with no influence over annotation-driven injection points. The default 'no' simply means no externally driven autowiring convention. |
Rob Winch commented Thanks for the fast reply. The intended behavior seems to conflict with the Javadoc which states:
It's also inconsistent with the XML configuration. It would also be really nice to be able to disable autowiring on a |
Juergen Hoeller commented Good point, we should at least reword the javadoc there... |
Rob Winch commented Juergen Hoeller Thanks for the response. I'm curious about the rational between what appears to be a big difference between: <bean class="..." autowire="no" /> and @Bean(autowire=NO) It seems that the behavior you are describing for <bean class="..." autowire="default" /> I understand that there are passivity concerns in the mix here. However, I'd also really like to be able to disable autowiring for a |
Juergen Hoeller commented The behavior is identical to the XML equivalent. "default" there just refers to the default value of the attribute at the
So I guess we should have a similar note on For your purposes, we'd have to introduce some mechanism on |
Juergen Hoeller commented I've added a clarifying remark to |
Rob Winch opened SPR-14282 and commented
Given the following classes:
It is not logical that the following test will fail since the
autowire
attribute on@Bean
is by defaultNO
:Affects: 3.2.17, 4.2.6, 4.3 RC2
Issue Links:
@Configuration
mark@Inject
fields and setters as satisfied (injected)?Referenced from: commits 7da1295, 98eaf05, a0a2a33
Backported to: 4.2.7, 3.2.18
The text was updated successfully, but these errors were encountered: