Skip to content

DefaultListableBeanFactory.getBeanNamesForAnnotation : Improve javadoc [SPR-17392] #21925

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

Closed
spring-projects-issues opened this issue Oct 16, 2018 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: task A general task
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Philipp Foermer opened SPR-17392 and commented

For "org.springframework.beans.factory.support.DefaultListableBeanFactory" the javadoc of

public java.lang.String[] getBeanNamesForAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)

defines:

Find all names of beans whose Class has the supplied Annotation type, without creating any bean instances yet.

It would be nice, if the wording is precised, as a registered FactoryBean BeanDefinition is eagerly initialized, if the method is invoked.

I noticed this unexpected behaviour in a custom @Conditional Condition implementation, causing broken factory bean instances, because required preconditions have not been initialized before factory bean was eagerly initialized.

It seems that the eager initialization issue as been worked around in "org.springframework.boot.autoconfigure.condition.BeanTypeRegistry" by missing this case.


Affects: 4.3.17

Referenced from: commits 5a6c081, cd66467, da23505

Backported to: 5.0.11, 4.3.21

@spring-projects-issues spring-projects-issues added status: backported An issue that has been backported to maintenance branches in: core Issues in core modules (aop, beans, core, context, expression) type: task A general task labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.1.2 milestone Jan 11, 2019
This was referenced Jan 11, 2019
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) status: backported An issue that has been backported to maintenance branches type: task A general task
Projects
None yet
Development

No branches or pull requests

2 participants