Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 965767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:03:03+00:00 2026-05-16T02:03:03+00:00

I have what seems to be a simple problem, as stated in the title.

  • 0

I have what seems to be a simple problem, as stated in the title. Here is the kind of class I have :

public class Foo {
    @Autowired
    public Foo(@Qualifier("bar") Set<String> bar) {
        // ...
    }
}

Which I try to run with the following spring context :

<context:annotation-config />
<util:set id="bar">
    <value>tata</value>
    <value>titi</value>
    <value>toto</value>
</util:set>
<bean id="foo" class="Foo" />

This fails to run with :

No matching bean of type
[java.lang.String] found for
dependency [collection of
java.lang.String]: expected at least 1
bean which qualifies as autowire
candidate for this dependency.
Dependency annotations:
{@org.springframework.beans.factory.annotation.Qualifier(value=bar)}

Note that if I add other parameters to my constructor, it works fine. If I use setter injection, it works fine. I’m sure I miss something obvious … do you know what ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T02:03:03+00:00Added an answer on May 16, 2026 at 2:03 am

    Autowiring collections is not possible using the @Autowired annotation. An autowired collection means “to provide all beans of a particular type”. Using the JSR-250 @Resource annotation, you can declare that you want a resource injected by its name, not its type. Or you inject the dependency explicitly.

    […] beans which are themselves defined as a collection or map type cannot be injected via @Autowired since type matching is not properly applicable to them. Use @Resource for such beans, referring to the specific collection/map bean by unique name.

    See the Spring documentation for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple problem and as I'm an F# newbie I can't seem
I have a rails controller I dont ever want to set a cookie. I
Here's the scenario: ASP.NET MVC2 Web Application Entity Framework 4 (Pure POCO's, Custom Data
I have recently started learning SQL, I can't determine what is causing my syntax
I seem to have a classic task, yet I can't find any examples on
Here's my situation. I've just started a new job and I've inherited an application
I recently started using Mercurial and like the way I have VCS protection for
I am writing a short and simple profiler (in C), which is intended to
I've taken to putting module code directly in a packages __init__.py , even for
Currently, we use an unmanaged DLL from a vendor that allows us to access

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.