Accepted upstreamCorrectnessRebased and merged May 26, 2026
Do not complete job from FlowStep
Prevented FlowStep execution from marking the enclosing job complete before later SimpleJob steps have run.
spring-projects/spring-batch · #5394
Problem
A job with a FlowStep followed by another step could expose the enclosing JobExecution as COMPLETED while additional steps were still pending, making downstream wait or monitoring logic unreliable.
Approach
Stopped FlowStep from directly completing the enclosing JobExecution. The contribution maps the flow result back to the step status and exit status while leaving the outer job lifecycle under SimpleJob control.
Impact and scope
- Improves Spring Batch job-state correctness for workflows that combine FlowStep with additional SimpleJob steps.
- Prevents downstream monitoring and wait logic from seeing a job as complete while later steps still need to run.
- Keeps completion ownership at the outer job level, which is the safer lifecycle boundary for multi-step batch jobs.
Validation
- Added a regression test with a FlowStep followed by a second step.
- Asserted the second step still observes the job as STARTED.
- Verified the final JobExecution completes only after the remaining step runs.