Skip to content

@Qualifier fails to resolve Lists containing enumerated types [SPR-7676] #12332

Closed

Description

@spring-projects-issues

Kyrill Alyoshin opened SPR-7676 and commented

So, let's say we have an enumerated list declared as the following in my Spring XML:

<util:list id="myList" value-type="spring.BasicEnum" list-class="java.util.ArrayList">
<value type="spring.BasicEnum">ONE</value>
<value type="spring.BasicEnum">THREE</value>
</util:list>

When I am injecting it in a service bean like this:

@Autowired
@Qualifier("myList")
public void setEnumList(List<BasicEnum> enumList) {
this.enumList = enumList;
}

I am getting the following container startup exception:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [spring.BasicEnum] found for dependency [collection of spring.BasicEnum]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}

I've attached a test case micro project for this.

If @Qualifier is not used, and the list is injected through XML, then everything works as expected.


Affects: 3.0.4

Attachments:

Issue Links:

Activity

  1. spring-projects-issues commented on Jul 7, 2011

    @spring-projects-issues
    CollaboratorAuthor

    Chris Beams commented

    Please see #13164, which aims to address this and a number of other similar issues related to collection autowiring.

  2. added
    type: bug
    in: core
    status: duplicate
    and removed
    type: bug
    on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: corestatus: duplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions