title: Create singelton beans from enum
body: <p>I have an enum that looks like the following</p>
  
  <pre class="lang-java prettyprint-override"><code>public enum MyBeanType {
    Type1,
    Type2
    ...
    Type100;
  }
  </code></pre>
  
  <p>I would like to create a Bean for each of these enum values.  </p>
  
  <pre class="lang-java prettyprint-override"><code>public Class MyBean {
    private MyBeanType type;
  
   public MyBean(MyBeanType type) { this.type = type; }
  }
  </code></pre>
  
  <p>I know I could list each of these in my config like so:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Configuration
  public class MyBeanConfig() {
  
    @Bean public MyBean myBeanType1() { return new MyBean(MyBeanType.Type1);
    @Bean public MyBean myBeanType2() { return new MyBean(MyBeanType.Type2);
    ... 
    @Bean public MyBean myBeanType100() { return new MyBean(MyBeanType.Type100);  
  
  }
  </code></pre>
  
  <p>But is there a way to do this more dynamically?
  I'm typically wiring all of these in as a <code>List</code>, but there are some instances where I'd like to wire <code>myBeanType2</code> by name as well.</p>