-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Labels
for: backport-to-5.0.xIssues that will be back-ported to the 5.0.x lineIssues that will be back-ported to the 5.0.x linein: coretype: bug
Milestone
Description
Bug description
If you create a "Flow" and use the "next" method instead of the "start" method to add the first step, then this step will be executed twice.
The problem is in the line addTransition("COMPLETED", next);. It is she who makes Flow perform the step a second time.
Line 249 in e6c2727
| private void doNext(Object input) { |
Current version:
private void doNext(Object input) {
if (this.currentState == null) {
doStart(input);
}
State next = createState(input);
addTransition("COMPLETED", next);
addTransition("*", failedState);
this.currentState = next;
}Fixed version:
private void doNext(Object input) {
if (this.currentState == null) {
doStart(input);
} else {
State next = createState(input);
addTransition("COMPLETED", next);
addTransition("*", failedState);
this.currentState = next;
}
}Environment
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
<version>3.1.2</version>
Steps to reproduce
FlowBuilder<Flow> flowBuilder = new FlowBuilder<>("someFlowName");
flowBuilder.next(step);
return flowBuilder.build();Expected behavior
Created "Flow" with one step. Step executed once.
Minimal Complete Reproducible example
The step was to transfer data from one table to another identical table. The second run of the step failed only because a unique primary key constraint was created.

Metadata
Metadata
Assignees
Labels
for: backport-to-5.0.xIssues that will be back-ported to the 5.0.x lineIssues that will be back-ported to the 5.0.x linein: coretype: bug