Add decider as a first step for a Spring Batch job (in JavaConfig style)

Viewed 202

We are migrating XML-style Spring Batch jobs to JavaConfig, and found out that it seems not possible to use a decider() as the first step in the job flow logic, right after start(). We need to put a dummy step in order to invoke a decider.

However, in XML, this configuration works perfectly fine:

    <batch:decision decider="exitsDecider" id="exitsInstance">
        <batch:next on="CONTINUE" to="jobStartStep" />
        <batch:end on="COMPLETED" exit-code="COMPLETED" />
        <batch:fail on="FAILED" exit-code="FAILED" />
    </batch:decision>

    <batch:step id="jobStartStep" next="validateStep">
        <batch:tasklet ref="jobStartTasklet" />
    </batch:step>

Don't know whether this is an undocumented feature, or just some side of corner case. What would be the equivalent in Java Config?

0 Answers
Related