InjectionPoint not propagated by AutowiredAnnotationBeanPostProcessor's cached argument resolution [SPR-14400] #18971
Comments
Juergen Hoeller commented This was caused by This will be available in the upcoming |
Sebastian Staack commented I have checked my example against the current Thanks for the quick fix. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sebastian Staack opened SPR-14400 and commented
When there is a prototype bean with a field annotated with
@Autowired
whose value is a prototype bean created in dependence of its injection point it seams that the the injection point isn't propagated.Test setup:
If I execute the test then I get the following log:
The lines 16:36:54.757 and 16:36:54.758 in the log show that the InjectionPoint of the Logger field differs, because the injection point's member declaring class is used to instantiate the logger. I would expect that they don't differ because both times the same bean is instantiated.
After a closer look I recognized that the second logger is instantiated for the test class MyTest, so I assume that the injection point isn't populated recursively. To prove my assumption I created the method
MyTest#main()
where I setup anApplicationContext
by hand. When I execute this method I get the following log:This log confirmed my assumption from above, because now there isn't a parent injection point and the thrown error state that there isn't an current injection point at all. I guess the that the method
AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject
must be fixed to populate the injection point of its field viaConstructorResolver#setCurrentInjectionPoint()
.I have attached a maven project so that you are able to reproduce the observed behavior.
Affects: 4.3 GA
Attachments:
Issue Links:
@Bean
methodReferenced from: commits e15f7ef
The text was updated successfully, but these errors were encountered: