title: Reading a dynamic property map into Spring managed bean
body: <p>I have a properties file like this:</p>
  
  <pre><code>my.properties file:
  app.One.id=1
  app.One.val=60
  
  app.Two.id=5
  app.Two.val=75
  </code></pre>
  
  <p>And I read these values into a map property in my bean in Spring config file like this:</p>
  
  <pre><code>spring-config.xml:
  &lt;bean id="myBean" class="myClass" scope="singleton"&gt;
      &lt;property name="myMap"&gt;
          &lt;map&gt;
              &lt;entry key="${app.One.id}" value="${app.One.val}"/&gt;
              &lt;entry key="${app.Two.id}" value="${app.Two.val}"/&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>This way if I add a new id/val to the properties file, I must add a row in config xml in order to have the new id/val in myMap.</p>
  
  <p>My question is, is there a way to specify the  key-val pairs in spring config file so that the number of key-vals defined in xml can figure out the items in the properties file and create a map. Basically I want to use this xml file in different environments where we use different number of key-value items in properties file. I just don't want to change the xml file in each environment to read in all these values.</p>
  
  <p>Let me know if you need any other details. Any thoughts/comments is appreciated. Thanks!</p>