Skip to content

Dependency Injection issue when using ManagedMap or ManagedList in BeanDefinitionParser [SPR-11131] #15757

Closed
@spring-projects-issues

Description

@spring-projects-issues

Chris Mathews opened SPR-11131 and commented

I just hit an issue when upgrading one of my projects from Spring 3.2.4 to 3.2.5. Here is the basic scenario simplified down to the core details:

  • Implemented a custom Spring namespace
  • Programatically wiring up a bean class, let's call it WidgetRegistry that maintains a Map<String, WidgetStack>
  • The WidgetStack instances are also programatically wired in the namespace and they maintain a List<Widget>.
  • The Widget is a simple class that has one member variable injected on it using @Inject.

I have tested this scenario from 3.0.0 all the way up to 3.2.4 and everything works as expected (4.0.0.M1 - M3 also work). When I upgrade to 3.2.5, 4.0.0.RC1 or 4.0.0-SNAPSHOT however things explode. The problem is that the Widget instances (inside the List) are no longer being injected upon. To be more exact only the first element (index 0) is not being injected upon... the rest of the Widget instances are being fully populated. This also only occurs when implemented as part of a custom namespace using ManagedMap and ManagedList to wire the appropriate Collections. If I wire the beans explicitly in Spring xml then everything works as expected.

Attached is a small sample project I threw together to demonstrate the problem.


Affects: 3.2.5, 4.0 RC1

Attachments:

Issue Links:

Referenced from: commits 242ecdc, d0fc38e

Backported to: 3.2.6

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions