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

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

Closed
spring-issuemaster opened this issue Oct 16, 2018 · 0 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Oct 16, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.