Discussed in #5298
Originally posted by scordio February 19, 2026
Imagine a step where there is an ItemReader and ItemWriter, without an ItemProcessor:
- The reader returns
null immediately
- The writer is never invoked
So far, everything looks good.
Now imagine a step where there is an ItemReader, an ItemProcessor, and an ItemWriter:
- The reader returns only one item, then returns
null
- The processor always returns
null --> each item is filtered
- The writer is invoked with an empty chunk
Is the writer's invocation with an empty chunk really intended?
The same behavior also occurs in a fault-tolerant step when skipping all items rather than filtering them.
The background of this question is whether custom writer implementations should expect potential empty chunks. If yes, it might be good to emphasize this in the ItemWriter contract.
We detected it in Spring Batch 4.3.10 and confirmed that 6.0.0 shows the same behavior.
Discussed in #5298
Originally posted by scordio February 19, 2026
Imagine a step where there is an
ItemReaderandItemWriter, without anItemProcessor:nullimmediatelySo far, everything looks good.
Now imagine a step where there is an
ItemReader, anItemProcessor, and anItemWriter:nullnull--> each item is filteredIs the writer's invocation with an empty chunk really intended?
The same behavior also occurs in a fault-tolerant step when skipping all items rather than filtering them.
The background of this question is whether custom writer implementations should expect potential empty chunks. If yes, it might be good to emphasize this in the
ItemWritercontract.We detected it in Spring Batch 4.3.10 and confirmed that 6.0.0 shows the same behavior.