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

Regression: InjectionMetadata cache needs to handle different bean classes per bean name

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 3.2.5, 4.0 GA
    • Fix Version/s: 3.2.7, 4.0.1
    • Component/s: None
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      In my project I use a request-scoped factory bean in order to inject the expected implementation between several beans (singletons) depending on request context.
      So given a bean name, several candidates can be injected.

      The InjectionMetadata cache in AutowiredAnnotationBeanPostProcessor use the bean name as a key. (See AutowiredAnnotationBeanPostProcessor.findAutowiringMetadata(String beanName, Class<?> clazz))
      In my case it doesn't work because it doesn't always return the metadata of the corresponding class, instead it will always return the metadata of the first used class.

      I attached a test project to reproduce this bug, just run the included junit test.
      Seems to be reproducible since 3.2.5.RELEASE and still present on 4.0.0.RELEASE

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              juergen.hoeller Juergen Hoeller
              Reporter:
              zeludo Ludovic Ronsin
              Last updater:
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 37 weeks, 1 day ago