title: Externalizing configuration in Spring Boot with multiple applications running in the same container
body: <p>I'm building multiple Spring Boot applications which will be deployed on the same servlet container. But I'm having difficulties getting Spring Boot to work with externalized configuration files the way I want, and not like the framework wants.</p>
  
  <p><strong>Situation:</strong></p>
  
  <ul>
  <li>multiple Spring Boot applications will be deployed on a single servlet container (WAR file)</li>
  <li>the location of configuration files will be set via JVM property <code>spring.config.location</code></li>
  <li>embedded deployment is not an option</li>
  </ul>
  
  <p><strong>Problem:</strong></p>
  
  <p>As the  applications are deployed on the same JVM, the property <code>spring.config.location</code> has the same value for all applications. I want our applications to all use the same configuration file naming (application.properties), so specifying <code>spring.config.name</code> is not an option. </p>
  
  <p><strong>What I would like:</strong></p>
  
  <ul>
  <li>no need to set <code>spring.config.name</code> as the configuration name should be standardized accross all our applications (constant)</li>
  <li>the externalized configuration properties should override values from application.properties packaged inside my deployed WAR</li>
  <li>profile specific configurations (application-{profile}) should be possible</li>
  <li>no hardcoded config locations in code</li>
  <li><p>organizing configuration files in a per-application directory layout:</p>
  
  <p>${spring.config.location}/app1/application.properties
  ${spring.config.location}/app2/application.properties
  ${spring.config.location}/app3/application.properties</p></li>
  </ul>
  
  <p><strong>Questions:</strong></p>
  
  <p>Is there some mechanism to influence or override loading or resolving of external configuration files?</p>
  
  <p>Are there other approaches to get the desired result?</p>