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

Injection of Provider fails for prototype-scoped beans

    Details

    • Last commented by a User:
      false

      Description

      I tried to migrate an existing spring application from 3.0.5 to 3.1.2 and I've noticed a strange bug, that the injection of a provider works the first time but passes subsequent times.

      It seems due the call of DependencyDescriptor.increaseNestingLevel() in the constructor of DependencyObjectFactory. Since the Descriptor is cached, the subsequent calls to BeanFactory.resolveDependency no longer return a Provider, but a reference to the bean.

      I've attached a testcase, which reproduces the problem. The bug seems to be introduced in 3.1.1, according to my tests.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                juergen.hoeller Juergen Hoeller
                Reporter:
                mattk Kilian Matt
                Last updater:
                Chris Beams
              • Votes:
                2 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 41 weeks, 3 days ago