title: How to load Name Value property using @ConfigurationProperties in Spring
body: <p>My property file has a content as follows</p>
  
  <blockquote>
    <p>config.entry[0]=X-FRAME-OPTIONS,SAMEORIGIN</p>
    
    <p>config.entry[1]=Content-Security-Policy,Frame-Ancestors 'self'</p>
  </blockquote>
  
  <p>I want this to be loaded to a config class where i can have the comma seperated values loaded as Key,Value pairs in a collection. How can this be achieved using @ConfigurationProperties in Spring 3 ?</p>
  
  <p>Entries = config.getEntry() should give me a collection so that I can iterate and get the list of name value pairs defined in the property file</p>
  
  <pre><code>for(Entry&lt;String,String&gt; index : config.getEntry().entryset()) {
            index.getKey(); // Should Give - X-FRAME-OPTIONS
            index.getValue(); // Should Give - SAMEORIGIN
  }
  </code></pre>
  
  <p>How should i define my Config class that will be autowired with the values from the properties file in this way ?</p>
  
  <p>the following implementation, throws Spring exception <strong><em>"Cannot convert value of type [java.lang.String] to required type [java.util.Map]" for property 'entry[0]': no matching editors or conversion strategy found]</em></strong></p>
  
  <pre><code>@Component
  @ConfigurationProperties("config")
  public class MyConfiguration {
  
    private Map&lt;String,Map&lt;String,String&gt;&gt; entry = new LinkedHashMap&lt;String,Map&lt;String,String&gt;&gt;();
  
    //getter for entry
  
    //setter for entry
  }
  </code></pre>