I'm trying to make a Spring Batch and I have no experience with it.
Is it possible to pass information from each batch step or must they be completely independent?
For example if I have
<batch:step id="getSQLs" next="runSQLs">
<batch:tasklet transaction-manager="TransactionManager"
ref="runGetSQLs" />
</batch:step>
<batch:step id="runSQLs">
<batch:tasklet transaction-manager="TransactionManager"
ref="runRunSQLs" />
</batch:step>
And getSQLs triggers a bean which executes a class which generates a List of type String. Is it possible to reference that list for the bean triggered by runSQLs? ("triggered" may not be the right term but I think you know what I mean)
UPDATE: So getSQLs step triggers this bean:
<bean id="runGetSQLs" class="myTask"
scope="step">
<property name="filePath" value="C:\Users\username\Desktop\sample.txt" />
</bean>
which triggers myTask class which executes this method:
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
ExecutionContext stepContext = this.stepExecution.getExecutionContext();
stepContext.put("theListKey", sourceQueries);
return RepeatStatus.FINISHED;
}
Do I need to somehow pass stepExecution to the execute method?