title: application.properties outside jar file how to
body: <p>As stated in <a href="http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html" rel="noreferrer">spring-boot-reference</a>:</p>
  
  <blockquote>
    <p>On your application classpath (e.g. inside your jar) you can have an
    application.properties that provides a sensible default property value
    for name. When running in a new environment, an application.properties
    can be provided outside of your jar that overrides the name</p>
  </blockquote>
  
  <p>I place a duplicated application.properties with overridden name on the same path as jar file, however when running the application with:</p>
  
  <pre><code>java -jar target/myproject-0.0.1-SNAPSHOT.jar
  </code></pre>
  
  <p>The name value is not overridden, it still refers to the one inside application.properties inside jar file. I also tried:</p>
  
  <pre><code>java -Dspring.config.location=/target/application.properties -jar target/myproject-0.0.1-SNAPSHOT.jar
  </code></pre>
  
  <p>But it does not work, please help.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>When I change the current directory to <code>target</code> and run it, it works. </p>
  
  <pre><code>java -jar myproject-0.0.1-SNAPSHOT.jar
  </code></pre>
  
  <p>Why? Why cannot be outside the path and run it?</p>