Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-17392

DefaultListableBeanFactory.getBeanNamesForAnnotation : Improve javadoc

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 4.3.17
    • Fix Version/s: 4.3.21, 5.0.11, 5.1.2
    • Component/s: Core
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            pfoermer Philipp Foermer
            Last updater:
            Spring Issuemaster
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 37 weeks ago