Spring Batch - Pass args into job parameters builder
<p>I have my xml : launch-context.xml contains : </p>

<pre><code>&lt;bean id="flatFileItemReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step"&gt;
    &lt;property name="resource"  value="file:#{jobParameters['input.file.name']}" /&gt;
    &lt;property name="lineMapper" ref="lineMapper"/&gt;
&lt;/bean&gt;
</code></pre>

<p>I want to save arg[0] as the filePath. Is this the correct way? I am not sure</p>

<pre><code>public static void main(String[] args) {

    JobParameters param =  new  JobParametersBuilder().addString("input.file.name", args[0]).toJobParameters();
    ApplicationContext context = new ClassPathXmlApplicationContext("launch-context.xml");
}
</code></pre>

<p>Thanks</p>