title: Autowiring a collection via the constructor with Spring
body: <p>I have what seems to be a simple problem, as stated in the title. Here is the kind of class I have :</p>
  
  <pre><code>public class Foo {
      @Autowired
      public Foo(@Qualifier("bar") Set&lt;String&gt; bar) {
          // ...
      }
  }
  </code></pre>
  
  <p>Which I try to run with the following spring context :</p>
  
  <pre><code>&lt;context:annotation-config /&gt;
  &lt;util:set id="bar"&gt;
      &lt;value&gt;tata&lt;/value&gt;
      &lt;value&gt;titi&lt;/value&gt;
      &lt;value&gt;toto&lt;/value&gt;
  &lt;/util:set&gt;
  &lt;bean id="foo" class="Foo" /&gt;
  </code></pre>
  
  <p>This fails to run with :</p>
  
  <blockquote>
    <p>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)}</p>
  </blockquote>
  
  <p>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 ?</p>