Should @Configuration mark @Inject fields and setters as satisfied (injected)? [SPR-14180] #18751
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Christian Hersevoort opened SPR-14180 and commented
Somewhat related to my other issue: #18750 (It's a different way to solve the same problem)
The case is as follows:
Beans:
I expect the MyParentBean.myChild field to only be Injected by the
@Configuration
, and not by both ConfigurationClassPostProcessor and the AutowiredAnnotationBeanPostProcessor.Expected:
What happens:
Changing between field and property injection doesn't help either e.g:
Changing
@Bean
to@Bean
(autowire = Autowire.NO) doesn't help either, e.g:Is this expected behavior? I expect org.springframework.beans.factory.annotation.InjectionMetadata.InjectedElement#checkPropertySkipping to be true and skip injection.
If this is expected behavior: is there a way to prevent
@Bean
to be injected again by the AutowiredAnnotationBeanPostProcessor?Issue Links:
@Bean
(autowire=NO)The text was updated successfully, but these errors were encountered: