title: Flag to switch between dev and prod values in servlet-context
body: <p>Our Spring 3.1.3 MVC project (built using Maven) has a <code>servlet-context.xml</code> riddled with beans and bean arguments that need to be updated with production values every time we make a deployment. Sometimes the dev responsible to make the production build fails to update these values and it would be nice to have a way to make automated builds for production (currently we only have automated builds for CI and these values depend on what the devs last pushed to the central code repository, so we can't get 100% code coverage with unit tests).</p>
  
  <p>This is one example of dev vs. prod values in our servlet-context:</p>
  
  <pre><code>&lt;beans:bean id="projectApp" class="com.project.app"&gt;
      &lt;beans:property name="config" ref="config"/&gt;
  &lt;/beans:bean&gt;
  
  &lt;beans:bean id="config" class="com.project.Config"&gt;
      &lt;!-- Dev --&gt;
      &lt;beans:property name="firstServiceUrl" value="http://localhost:8010/"/&gt;
      &lt;beans:property name="secondServiceUrl" value="http://localhost:8020/"/&gt;
      &lt;beans:property name="database" value="localhost"/&gt;
      &lt;!-- QA --&gt;
      &lt;!-- &lt;beans:property name="firstServiceUrl" value="https://qa.services.url/first/"/&gt; --&gt;
      &lt;!-- &lt;beans:property name="secondServiceUrl" value="https://qa.services.url/second/"/&gt; --&gt;
      &lt;!-- &lt;beans:property name="database" value="192.168.5.5"/&gt; --&gt;
      &lt;!-- Production --&gt;
      &lt;!-- &lt;beans:property name="firstServiceUrl" value="https://prod.services.url/first/"/&gt; --&gt;
      &lt;!-- &lt;beans:property name="secondServiceUrl" value="https://prod.services.url/second/"/&gt; --&gt;
      &lt;!-- &lt;beans:property name="database" value="192.168.5.5"/&gt; --&gt;
  &lt;/beans:bean&gt;
  </code></pre>
  
  <p>Is there a way to easily and quickly switch between values? Can we have a flag which tells Spring or Maven that we're doing a production build to make it use the production values? Is there a way to export the build type in the target <code>.war</code> file name using Maven, to get something like <code>project-1.0.0-dev.war</code> and <code>project-1.0.0-production.war</code>?</p>