title: Setting a properties file in Spring Batch via a JobParameter
body: <p>I have three different .properties files in a Spring Batch project, and I'm trying to set which .properties file should be used as a JobParameter. I'd like to be able to run the job like so:</p>
  
  <pre><code>java CommandLineJobRunner context.xml jobName region=us
  </code></pre>
  
  <p>The region should specify which .properties file should be used. The problem is getting the context to recognize the JobParameter. I've tried the following to no avail:</p>
  
  <pre><code>&lt;context:property-placeholder location="classpath:batch.#{jobParameters['region']}.properties"/&gt;
  </code></pre>
  
  <p>And also:</p>
  
  <pre><code>&lt;util:properties id="batchProperties" location="classpath:batch.#{jobParameters['region']}.properties"&gt;&lt;/util:properties&gt;
  </code></pre>
  
  <p>I had heard that adding scope="step" could fix similar issues, but I tried adding that to both of the above solutions and still had exceptions.</p>
  
  <p>I think I'm missing a fundamental idea of why I can't get this working, but I'm unable to figure out what that idea is.</p>
  
  <p>If anyone has any suggestions on getting this working and/or explaining why my previous approaches failed, I'd appreciate it.</p>