title: Spring Java Configuration - how do create a map of enums to beans-references
body: <p>with Java based configuration, i am trying to convert a map that maps enums to bean references to be in pure java config (currently in XML &amp; works) but can't seem to find anything in the documentations;</p>
  
  <p>Currently, my XML like so;</p>
  
  <pre><code>&lt;util:map id="colourHanders" key-type="com.example.ColourEnum"
            value-type="com.example.ColourHandler"&gt;
      &lt;entry key="white" value-ref="whiteColourHandler"/&gt;
      &lt;entry key="blue" value-ref="blueColourHandler"/&gt;
      &lt;entry key="red" value-ref="redColourHandler"/&gt;
  &lt;/util:map&gt;
  </code></pre>
  
  <p>I'm sure it is easy but again, can't find anything on the subject of how to represent this in Pure Java (so I don't have any XML configuration files)..</p>
  
  <p>Note; the <code>ColourHandler</code> beans are created using the @Component annotation, e.g.. </p>
  
  <pre><code>@Component
  public class RedColourHandler implements ColourHander{
  .....
  }
  </code></pre>
  
  <p>and the map of colourHandlers is referenced as so; </p>
  
  <pre><code>@Resource(name="colourHandlers")
      private Map&lt;ColourHandlerEnum, ColourHandler&gt; colourHandlers;
  </code></pre>
  
  <p>Thanks,</p>
  
  <p>Ian.</p>