In XML file i have configured two Processor using CompositeItemProcessor
<processor>
<beans:bean id="CompositeItemProcessor" class="org.springframework.batch.item.support.CompositeItemProcessor" scope="step">
<beans:property name="delegates">
<beans:list>
<beans:ref bean="oldProcessor"/>
<beans:ref bean="newProcessor"/>
</beans:list>
</beans:property>
</beans:bean>
</processor>
and in "oldProcessor" bean java file i have added below code to get StepExecution object.
@BeforeStep
@Order(1)
public void setStepExecution(StepExecution stepExecution) {
this.stepExecution = stepExecution;
}
but above code not executing. only process() method calling from "oldProcessor" bean.
and when i tried without configuring CompositeItemProcessor,then this "setStepExecution()" method and process() method are executing of oldProcessor bean. eg.
<processor>
<beans:ref bean="oldProcessor"/>
</processor>
Please advise me, how to get stepExecutionContext in Processor using CompositeItemProcessor
Try with the following in your processor.
@Value("#{stepExecution}")
private StepExecution stepExecution;
This should work if the scope is step.