Skip to content

Spring includes incorrect values in @Autowired List #29987

Closed as not planned
Closed as not planned
@armogur

Description

@armogur

In SpringBoot 3.0.2 I created a bean (list of strings: List<String> variable;), but when I use it, the dependency injection inserts wrong values.

Code example: https://github.com/armogur/collection-demo

Run the code and observe the output, the line starts with two should have the same values that starts with goodWithQualifier.

Workaround:

  1. Remove the type parameter at insertion point(s) like this:
@Autowired
List two;
  1. Add qualifier, for example:
@Autowired
@Qualifier("two")
List<String> goodWithQualifier;

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions