title: How to use property-placeholder for file on filesystem
body: <p>We used to have a way to load properties from a file on the classpath:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;context:property-placeholder location="classpath:myConfigFile.properties" /&gt;
  </code></pre>
  
  <p>and it worked great. But now we want to load properties from a specific file on the system that is NOT in the classpath. We wanted to be able to dynamically load the file, so we are using a Java environment variable to populate it. I'll give a simple example below:</p>
  
  <p>In Java:</p>
  
  <pre class="lang-java prettyprint-override"><code>  System.setProperty("my.prop.file", "/path/to/myConfigFile.properties");
  </code></pre>
  
  <p>In Spring XML:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;context:property-placeholder location="${my.prop.file}" /&gt;
  </code></pre>
  
  <p>I've also tried it this way, thanks to an idea from Luciano:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;context:property-placeholder properties-ref="prop" /&gt;
  
  &lt;util:properties id="prop" location="reso"/&gt;
  
  &lt;bean id="reso" class="org.springframework.core.io.FileSystemResource"&gt;
      &lt;constructor-arg index="0" value="${my.prop.file}" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Everything I've tried has failed. No matter what I set my.prop.file to. Greatest hits include:</p>
  
  <pre><code>&lt;context:property-placeholder location="/path/to/myConfigFile.properties" /&gt;
  (ClassNotFoundException: .path.to.myConfigFile.properties)
  
  &lt;context:property-placeholder location="file:/path/to/myConfigFile.properties" /&gt;
  (ClassNotFoundException: file:.path.to.myConfigFile.properties)
  
  &lt;context:property-placeholder location="file:///path/to/myConfigFile.properties" /&gt;
  (ClassNotFoundException: file:...path.to.myConfigFile.properties)
  </code></pre>
  
  <p>How do you use property-placeholders with a location that is on the file system and NOT on the classpath? We are using Spring 3.0.5.</p>
  
  <p>It turns out there was a problem with the script running the Java program that loads the spring file. Thank you for helping. I am going to request that this question be deleted, as the original code works after all.
  Thank you for your help.</p>