I suggest you use a processor that updates your Entity with a value. If your processors directly implement ItemProcessor<T> , you will not automatically receive StepExecution . To get StepExecution , do 1 of the following: - implement StepExecutionListener and set it as a variable from the beforeStep method - create a method called [something](StepExecution execution) and annotate using @BeforeStep
after you entered StepExecution through the listener, you can get jobExecutionId and set it to your entity
public class MyEntityProcessor implements ItemProcessor<MyEntity, MyEntity> { private long jobExecutionId; @BeforeStep public void beforeStep(StepExecution stepExecution) { jobExecutionId = stepExecution.getJobExecutionId(); } @Override public MyEntity process(MyEntity item) throws Exception {
source share