I could do it using by setting up stepExecutionListener to pur param1=value1 in stepExecutionContext.
public class SetParam1StepListener implements StepExecutionListener {
protected String param1;
public String getParam1() {
return param1;
}
public void setParam1(String param1) {
this.param1 = param1;
}
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
// TODO Auto-generated method stub
return null;
}
@Override
public void beforeStep(StepExecution stepExecution) {
stepExecution.getExecutionContext().put("param1", this.param1);
}
}
<beans:bean id="value1.setParam1StepListener" class="com.my.SetParam1StepListener" p:param1="value1" />
Then by adding param1 key to jobParameterExtractor
<beans:bean id="jobParametersExtractor"
class="org.springframework.batch.core.step.job.DefaultJobParametersExtractor">
<beans:property name="keys" value="param1" />
</beans:bean>
and then passing it to step job
<job id="job1">
<step id="step1" >
<job ref="step1.job1.1" job-parameters-extractor="jobParametersExtractor"/>
<listeners>
<listener ref="value1.setParam1StepListener" />
</listeners>
</step>
</job>
It works.