title: Java, Spring best practices to use variables in properties files
body: <p>I use org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.
  There are 3 properties files. So if properties duplicate - last wins.</p>
  
  <p>The first file contains all properties, others substitute some properties.
  I use e.g. variable like </p>
  
  <pre><code>log.dir=c:/log.
  </code></pre>
  
  <p>So I can substitute part of path in properties like </p>
  
  <pre><code>${log.dir}/app1.log
  </code></pre>
  
  <p>In first file I have 48 uses of this variable.</p>
  
  <p>In second file I have 25 substitutes for properties from first file, and 5 substitutes in third file.</p>
  
  <p>The problem that I need redefine this variable also in second and third file!</p>
  
  <p>I would like use the same name </p>
  
  <pre><code>log.dir
  </code></pre>
  
  <p>But if I define it in second or third file - redefining go back to first file - but I need  use for the rest 18 (48 -25 - 5=18) old properties.
  What the best practices in similar cases?
  Thanks.
  After some analysis I would like have variable that has the same name in all properties files, but values must not be overridden. So for first file  log.dir=c:\log, for the second  log.dir=d:\log, for the third  log.dir=e:\log. And when calculating paths for each file used own. So overridden must be only properties - not variables.</p>