title: Inject a list of beans using Spring @Configuration annotation
body: <p>I've got a Spring bean, and in the Spring Bean I have a dependency on a list of other beans. My question is: how can I inject a Generic list of beans as a dependency of that bean?</p>
  
  <p>For example, some code:</p>
  
  <pre><code>public interface Color { }
  
  public class Red implements Color { }
  
  public class Blue implements Color { }
  </code></pre>
  
  <p>My bean:</p>
  
  <pre><code>public class Painter {
    private List&lt;Color&gt; colors;
  
    @Resource
    public void setColors(List&lt;Color&gt; colors) {
        this.colors = colors;
    }
  }
  
  @Configuration
  public class MyConfiguration {
  
    @Bean
    public Red red() {
      return new Red();
    }
  
    @Bean
    public Blue blue() {
      return new Blue();
    }
  
    @Bean
    public Painter painter() {
      return new Painter();
    }
  }
  </code></pre>
  
  <p>The question is; how do I get the list of colors in the Painter? Also, on a side note: should I have the @Configuration return the Interface type, or the class?</p>
  
  <p>Thanks for the help!</p>