Skip to content
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

@Lookup doesn't work in case of AbstractBeanFactory's cacheBeanMetadata=false #25749

Closed
aliaksandr-budnikau opened this issue Sep 10, 2020 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@aliaksandr-budnikau
Copy link

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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 10, 2020
@jhoeller jhoeller self-assigned this Sep 10, 2020
@jhoeller jhoeller added in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 10, 2020
@jhoeller jhoeller added this to the 5.2.9 milestone Sep 10, 2020
@jhoeller jhoeller changed the title @Lookup doesn't work in case if BeanFactory's cacheBeanMetadata = false @Lookup doesn't work in case of AbstractBeanFactory's cacheBeanMetadata=false Sep 10, 2020
@jhoeller
Copy link
Contributor

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.

@jhoeller jhoeller added type: enhancement A general enhancement and removed type: bug A general bug labels Sep 11, 2020
@jhoeller jhoeller modified the milestones: 5.2.9, 5.3 RC1, 5.3 RC2 Sep 11, 2020
@jhoeller jhoeller modified the milestones: 5.3 RC2, 5.x Backlog Oct 5, 2020
@jhoeller jhoeller modified the milestones: 6.x Backlog, 6.1.0-M4 Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants