title: How to get command line parameters into a spring batch job
body: <p>I am using a CommandLineJobRunner to execute a spring batch job.  I want to pass in a set of parameters, but I'm running into some problems.  This is my step:</p>
  
  <pre><code>    &lt;bean id="loadTAReportsJob" class="org.springframework.batch.core.job.SimpleJob"&gt;
      &lt;property name="steps"&gt;
          &lt;bean id="loadStep" parent="simpleStep"&gt;
              &lt;property name="itemReader"&gt;
                  &lt;bean id="reader" class="com.xyz.reporting.TAReportItemReader"&gt;
                      &lt;property name="parm1" value="#{jobParameters['input.file']}" /&gt;
                      &lt;property name="parm2" value="#{jobExecutionContext['input.file']}" /&gt;
                      &lt;property name="parm3" value="#{stepExecutionContext['input.file']}" /&gt;
                  &lt;/bean&gt;
              &lt;/property&gt;
              &lt;property name="itemWriter"&gt;
                  &lt;bean id="writer" class="com.xyz.reporting.TAReportItemWriter"&gt;
                      &lt;property name="reportDomainFacade" ref="reportDomainFacade"/&gt;
                  &lt;/bean&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
      &lt;/property&gt;
      &lt;property name="jobRepository" ref="jobRepository"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>The CommandLineJobRunner reports that:</p>
  
  <pre><code>2407 [P=717580:O=0:CT] INFO support.SimpleJobLauncher  - Job: [SimpleJob: [name=loadTAReportsJob]] launched with the following parameters: [{input.file=somefile.zip}{}{}{}]
  </code></pre>
  
  <p>But in my ReportItemReader, the three parms all resolve to the full value:</p>
  
  <pre><code>#{jobParameters['input.file']}
  #{jobExecutionContext['input.file']}
  #{stepExecutionContext['input.file']}
  </code></pre>
  
  <p>That is, spring batch doesn't seem to be resolving the #{JobXYZ['parm name'].</p>
  
  <p>Do I have to do something special to make spring resolve that syntax and do the property lookup?  Do I need to wire up a JobParameters object or something to make this thing work?</p>
  
  <p>BTW - I'm using Spring Batch 1.1.4 to keep compat with java 1.4.2.</p>