title: Spring autowired collection of qualified beans
body: <p>I have some Spring @Components with @Qualifier annotations, let's say it's in example "A" and "B". I want to inject them (using only annotations) into List. How can I do that ?</p>
  
  <pre><code>@Component
  public class WhatIHave {
  
      @Autowired
      @Qualifier("A")
      private MyType firstBean;
  
      @Autowired
      @Qualifier("B")
      private MyType secondBean;
      ....
  }
  
  @Component
  public class WhatIWantToHave {
  
      @Autowired
      @Qualifier("A", "B") //something like that
      private List&lt;MyType&gt; beans;
      ...
  }
  </code></pre>
  
  <p>Do I need to make it in @Configuration class ? </p>
  
  <pre><code>@Configuration
  public class MyConfiguration {
  
      @Autowired
      @Qualifier("A")
      private MyType firstBean;
  
      @Autowired
      @Qualifier("B")
      private MyType secondBean;
  
      @Bean
      public List&lt;MyType&gt; beans() {
          return Lists.newArrayList(firstBean, secondBean);
      }
  }
  </code></pre>
  
  <p>Or there is another way to do that ?</p>