title: Load a key from a properties file in spring context dynamically
body: <p>I'm trying to load a key (has a value) in the properties file dynamically. This is what am trying to do. I have two app servers A &amp; B. And there is a quartz job that runs for every one hour in both the servers, which is causing some problems. To solve this, I would like to set a key in the properties file with server name (say serverA, serverB) and when I pass the quartz schedule to the cronbean (in spring xml) the value I should pass (which is the key from the properties file) should be dynamic. I mean, if hostname is server A, then the value from serverA should be loaded from properties file and the same with server B. Below is the snippet -</p>
  
  <pre><code>**application-host.xml - Initialized hostname in spring context**
  
  &lt;bean id="hostname" factory-bean="localhost" factory-method="getHostName"/&gt;
  &lt;bean id="localhost" class="java.net.InetAddress" factory-method="getLocalHost"/&gt;
  
  **application-quartz.xml - Place where am loading the quartz schedule**
  
  &lt;bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"&gt;
  
      &lt;property name="jobDetail" ref="job" /&gt;
      &lt;property name="cronExpression" value="${  serverA / serverB  }" /&gt; ** THIS IS WHERE I WANT TO SET OR LOAD PROPERTIES FROM THE FILE, BASED ON THE HOST NAME.
  &lt;/bean&gt;
  
  **env-test.properties**
  
  serverA = 0 0 3 * * ?
  serverB = 0 0 5 * * ?
  </code></pre>
  
  <p>I knew other ways, such as updating the properties file with different schedules before starting up the app server, but this is a little risky as there is a chance to miss during the deployment process. Appreciate if you can help me find a better solution or answer this one.</p>
  
  <p>Thanks, Sirish.</p>