title: How to externalize application.properties in Tomcat webserver for Spring?
body: <blockquote>
    <p>SpringApplication will load properties from application.properties
    files in the following locations and add them to the Spring
    Environment:</p>
  
  <pre><code>- A /config subdirectory of the current directory.
  - The current directory
  - A classpath /config package
  - The classpath root
  </code></pre>
    
    <p>The list is ordered by precedence (properties defined in locations
    higher in the list override those defined in lower locations).</p>
  </blockquote>
  
  <p><a href="https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-application-property-files" rel="noreferrer">https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-application-property-files</a></p>
  
  <p>Question: when running a <code>war</code> file on a <code>tomcat</code> server: how can I add an additional location for the <code>application.properties</code> <strong>outside</strong> the classpath or the tomcat container, like <code>d:\application.properties</code>?</p>
  
  <p>The custom location should get highest precedence regarding the locations above.</p>
  
  <p>Problem is: I could of course add a <code>/config</code> folder inside my exploded war in the tomcat <code>webapps</code> folder, but then I'd lose any custom configuration if the webapps folder is cleaned and war is redeployed.</p>
  
  <p>Thus I'd like to add an additional location outside.</p>