title: How to call properties file from another properties file using Spring PropertyPlaceholderConfigurer?
body: <p>I'm working on a command-line Java application using Spring. I have multiple properties files stored in different locations and one properties file containing the path for all those properties. I'm using PropertyPlaceholderConfigurer, to read properties containing the locations of different properties files. I'm not sure of the best way of handling multiple properties.</p>
  
  <p>The application works like this: I will pass the path for first properties file using JVM command -Dmypath=parent.properties. The properties file will look like this:</p>
  
  <pre><code>child1=/location1/child1.properties
  
  child2=/location2/child2.properties
  </code></pre>
  
  <p>so on</p>
  
  <p>My Parent properties configuration looks like this:</p>
  
  <pre><code>&lt;bean id="parentProperty" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
      &lt;property name="locations"&gt;
          &lt;list&gt;                
              &lt;value&gt;${mypath}&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>The child1 configuration looks:</p>
  
  <pre><code>&lt;bean id="child1Property" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt;
      &lt;property name="locations"&gt;
          &lt;list&gt;                
              &lt;value&gt;${child1}&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Now when I call child1 it fails to load the properties.</p>