Skip to content

Commit 6fdc225

Browse files
committed
Fix default retry limit when configuring fault tolerant steps
Resolves #5068
1 parent 3df1f34 commit 6fdc225

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

spring-batch-core/src/main/java/org/springframework/batch/core/step/builder/ChunkOrientedStepBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public class ChunkOrientedStepBuilder<I, O> extends StepBuilderHelper<ChunkOrien
101101

102102
private final Set<Class<? extends Throwable>> retryableExceptions = new HashSet<>();
103103

104-
private long retryLimit = -1;
104+
private long retryLimit = 0;
105105

106106
private @Nullable SkipPolicy skipPolicy;
107107

spring-batch-core/src/test/java/org/springframework/batch/core/step/item/ChunkOrientedStepIntegrationTests.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ void testFaultTolerantChunkOrientedStepSetupWithDefaultSkipLimit() {
8888
.build());
8989
}
9090

91+
@Test
92+
void testFaultTolerantChunkOrientedStepSetupWithDefaultRetryLimit() {
93+
Assertions.assertDoesNotThrow(() -> new StepBuilder(mock()).chunk(5)
94+
.reader(new ListItemReader<>(List.of("item1", "item2")))
95+
.writer(items -> {
96+
})
97+
.faultTolerant()
98+
.retry(Exception.class)
99+
.build());
100+
}
101+
91102
@Test
92103
void testChunkOrientedStep() throws Exception {
93104
// given

0 commit comments

Comments
 (0)