title: Load properties file in Spring depending on profile
body: <p>I have a Spring 3.1 application. Let's say it has an XML with the following content:</p>
  
  <pre><code>&lt;context:property-placeholder location="classpath:somename.properties" /&gt;
  
  &lt;context:property-placeholder location="classpath:xxx.properties" /&gt;
  </code></pre>
  
  <p>I would like some.properties to be always loaded (let's assume it exists), but the xxx part of the second place holder to be replaced by some name depending on the active profile. I've tried with this:</p>
  
  <pre><code>&lt;beans profile="xx1"&gt;
      &lt;context:property-placeholder location="classpath:xx1.properties" /&gt;
  &lt;/beans&gt;
  
  &lt;beans profile="xx2"&gt;
      &lt;context:property-placeholder location="classpath:xx2.properties" /&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>Also, both files have properties with the same key but different value.</p>
  
  <p>But it didn't work as some later bean that has a placeholder for one property whose key is defined in xx1.properties (and xx2.properties) makes Spring complain that the key is not found in the application context.</p>