title: Spring loading application.properties based on tomcat servlet context definition
body: <p>I need to have a development and production settings for our spring project. I understand that you can use profiles for spring but that is not something that we can do.</p>
  
  <p>What I want to do is place on the development environment a test-application.properties file and on production a prod-application.properties file. In the  tomcat context definition we sent the following:</p>
  
  <pre><code>&lt;Context&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;properties_location&lt;/param-name&gt;
          &lt;param-value&gt;file:C:\Users\Bill\test-application.properties&lt;/param-value&gt;
      &lt;/context-param&gt;
  &lt;/Context&gt;
  </code></pre>
  
  <p>And we can have the value changed for the production servers. In the spring config we have something like this:</p>
  
  <pre><code>&lt;bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer"&gt;
      &lt;property name="locations"&gt;
          &lt;list&gt;
              &lt;value&gt;${properties_location}&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
      &lt;property name="ignoreUnresolvablePlaceholders" value="false" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>But we keep getting errors like:</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.BeanInitializationException: Could
    not load properties; nested exception is
    java.io.FileNotFoundException: Could not open ServletContext resource
    [/${properties_location}]</p>
  </blockquote>
  
  <p>Any ideas on how to solve?</p>