I have a tasklet setting some information into my JobContext, and another one checking some stuff to know if I can execute the next steps in my batch or not. Both tasklets work well if I use two different steps in my job flow, but I'd like to use these two tasklets in the same step.
I tried to add twice ".tasklet(taskletName)" in my batch configuration like this :
return stepBuilderFactory.get("stepSettings").tasklet(taskletSettings).tasklet(taskletChecking).listener(executionContextListener).listener(stepExecutionListener).build();
It doesn't work: only one of the tasklets is executed (it seems to be the second one). I didn't see anything in spring doc ; is there a way to do this ? Or doesn't Spring allow to have more than one tasklet in the same step ?
Only one tasklet for step (I think this is by design).
If you need pre-conditions check to flow your job use a
JobExecutionDecider
.