title: Java - Spring - put entries in map based on some condition
body: <p>In a Java app which uses Spring (Spring version 3.2.3),<br>
  I have something like this: </p>
  
  <pre><code>&lt;bean id="pm" class="com.test.PropertyManager"&gt;
      &lt;property name="targets"&gt;
          &lt;map&gt;
              &lt;entry key="key01" value-ref="obj01" /&gt;
              &lt;entry key="key02" value-ref="obj02" /&gt;
              &lt;entry key="key03" value-ref="obj03" /&gt;
              &lt;entry key="key04" value-ref="obj04" /&gt;
              &lt;entry key="key05" value-ref="obj05" /&gt;
              &lt;entry key="key06" value-ref="obj06" /&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Is there any way to tell Spring to not put all entries in this map<br>
  but only some of them based on some property whose value can be<br>
  different for different environments the app is built for, and running in.  </p>
  
  <p>I mean, I am looking for something like:</p>
  
  <pre><code>&lt;bean id="pm" class="com.test.PropertyManager"&gt;
      &lt;property name="targets"&gt;
          &lt;map&gt;
              &lt;entry key="key01" value-ref="obj01" if="${env1}"/&gt;
              &lt;entry key="key02" value-ref="obj02" if="${env1}"/&gt;
              &lt;entry key="key03" value-ref="obj03" unless="${env1}"/&gt;
              &lt;entry key="key04" value-ref="obj04" unless="${env1}"/&gt;
              &lt;entry key="key05" value-ref="obj05" /&gt;
              &lt;entry key="key06" value-ref="obj06" /&gt;
          &lt;/map&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>So e.g. I want two entries to be added when the app is in environment <code>env1</code>, two other entries to be added when the app is running in another <code>env2</code>, and yet two others to be always added.</p>
  
  <p>Is that possible and if not, what are my alternatives?</p>