title: Reference Spring properties file using path relative to config file
body: <p>I am moving properties from inside my Spring config file to a separate properties file.  This is included in the config file with</p>
  
  <pre><code>&lt;bean class="org.springframework.beans.factory.config.PropertyPlaceHolderConfigurer"&gt;
    &lt;property name="location" value="file:properties/${CONFIG_MODE}/service.properties" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>As it stands, the location of the properties file is relative to the <em>current working directory</em> of the server process.</p>
  
  <p>This creates the requirement that the process must be started from a specific working directory, and even worse allows for the (admittedly remote) possibility that it could pick up an entirely different properties file - for example if it was started with the working directory set to an older version of the service.</p>
  
  <p>I'd like to reference the properties file using a path that is <strong>relative to the directory containing the config file</strong>.</p>
  
  <p>Looking at <a href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/core/io/FileSystemResource.html" rel="noreferrer">FileSystemResource</a>, it seems <a href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/core/io/FileSystemResource.html#createRelative%28java.lang.String%29" rel="noreferrer">createRelative</a> might be what I need, but I can't figure out how to use it in the config file.</p>
  
  <p>Thanks,</p>
  
  <p>Steve</p>