These are several ways to do this.
You can use StepExecutionListener and override the afterStep method:
@AfterStep public ExitStatus afterStep(){ //Test condition return new ExistStatus("CUSTOM EXIT STATUS"); }
Or use JobExecutionDecider to select the next step based on the result.
public class CustomDecider implements JobExecutionDecider { public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { if () { return new FlowExecutionStatus("OK"); } return new FlowExecutionStatus("OTHER CODE HERE"); } }
Xml config:
<decision id="decider" decider="decider"> <next on="OK" to="step1" /> <next on="OHTER CODE HERE" to="step2" /> </decision> <bean id="decider" class="com.xxx.CustomDecider"/>
source share