HI! I came across the use case when I wanted to create some provider with @Lookup but when our BeanFactory has cacheBeanMetadata = false, Spring can't create a proxy for the provider and then @Lookup doesn't work.
Here is my unit test for ease reproduction https://github.com/aliaksandr-budnikau/Lookup-annotation-bug/blob/master/src/test/java/org/example/MyComponentProviderTest.java
Thanks, Alex
Comment From: jhoeller
Why are you setting cacheBeanMetadata=false
, actually? Reviewing our getMergedBeanDefinition
usage within annotation processors in particular, there are several mechanisms that won't work as intended if metadata caching is turned off. In terms of its original design, cacheBeanMetadata=false
was only ever meant to work for simple non-post-processing definition scenarios with XML or programmatic definitions. While we might be able to address this specific case here, even with revised post-processor contracts, I'm not sure we can ever fully support that mode for the annotation-based programming model.