title: How to link the specific application.properties files based on Maven profile
body: <p>I have a plain Java project with several property files (for several environments):</p>
  
  <pre><code>application.properties
  application-dev.properties
  application-prod.properties
  </code></pre>
  
  <p>where:</p>
  
  <ul>
  <li><code>application.properties</code> is saving the configuration for the local (laptop) environment.</li>
  <li><code>application-dev.properties</code> is saving the configuration for the remote development environment.</li>
  <li><code>application-prod.properties</code> is saving the configuration for the remote production environment.</li>
  </ul>
  
  <p>I have then the following Maven profiles defined in my <code>pom.xml</code>:</p>
  
  <pre><code>&lt;profiles&gt;
      &lt;profile&gt;
          &lt;id&gt;local&lt;/id&gt;
          &lt;properties&gt;
              ...
          &lt;/properties&gt;
          &lt;activation&gt;
              &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
          &lt;/activation&gt;
      &lt;/profile&gt;
      &lt;profile&gt;
          &lt;id&gt;dev&lt;/id&gt;
          &lt;properties&gt;
              ...
          &lt;/properties&gt;
      &lt;/profile&gt;
      &lt;profile&gt;
          &lt;id&gt;prod&lt;/id&gt;
          &lt;properties&gt;
              ...
          &lt;/properties&gt;
      &lt;/profile&gt;
  &lt;/profiles&gt;
  </code></pre>
  
  <p>Then in my code I use this code to read the property file:</p>
  
  <pre><code>String rootPath = Thread.currentThread().getContextClassLoader().getResource("").getPath();
  String appConfigPath = rootPath + "application.properties";
  Properties properties = new Properties();
  properties.load(new FileInputStream(appConfigPath));
  </code></pre>
  
  <p>How can I adjust the code such that using a different Maven profile, a different property file is read?</p>