title: External web-application configuration in Tomcat
body: <p>There's a web application and a number of environments in which it works. In each environment it has different settings like DB connection and SOAP ends-points that in their turn are defined in properties-files and accessed in the following way:</p>
  
  <pre><code>config.load(AppProp.class.getClassLoader().getResourceAsStream(
      PROPERTIES_FILE_PATH + PROPERTIES_FILE_NAME));
  </code></pre>
  
  <p>Thus the WAR-files are different for every environment.</p>
  
  <p>What we need is to build a unified WAR-file that doesn't contain any configuration and works in any environment (for now, Tomcat instance) getting its configuration from outside its WAR-file.</p>
  
  <p>The answer <a href="https://stackoverflow.com/questions/1568985/java-web-application-configuration-patterns">Java Web Application Configuration Patterns</a>, to my mind, gives the full set of common approaches but with just few examples. The most attractive way is configuring JNDI lookup mechanism. As I can guess it allows to separately configure web-applications by their context paths. But couldn't find a simple (step-by-step) instructions in both the Internet and the Tomcat's docs. Unfortunately cannot spend much time on studying this complicated stuff in order to just meet so seemingly simple and natural demand :(</p>
  
  <p>Would appreciate your links at the relevant descriptions or any alternative suggestion on the problem.</p>