Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring includes incorrect values in @Autowired List #29987

Closed
armogur opened this issue Feb 16, 2023 · 1 comment
Closed

Spring includes incorrect values in @Autowired List #29987

armogur opened this issue Feb 16, 2023 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue

Comments

@armogur
Copy link

armogur commented Feb 16, 2023

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;
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 16, 2023
@bclozel bclozel transferred this issue from spring-projects/spring-boot Feb 16, 2023
@sbrannen sbrannen self-assigned this Feb 24, 2023
@sbrannen sbrannen added status: duplicate A duplicate of another issue in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 24, 2023
@sbrannen
Copy link
Member

sbrannen commented Feb 24, 2023

Hi @armogur,

Congratulations on opening your first issue for the Spring Framework! 👍

This is effectively a duplicate of #30022 and #16794.

In light of that, I am closing this issue.

@sbrannen sbrannen closed this as not planned Won't fix, can't repro, duplicate, stale Feb 24, 2023
@sbrannen sbrannen changed the title SpringBoot returns incorrect values in @Autowired bean Spring returns incorrect values in @Autowired List Feb 24, 2023
@sbrannen sbrannen changed the title Spring returns incorrect values in @Autowired List Spring includes incorrect values in @Autowired List Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants