Skip to content

Incorrect documentation about concurrent steps in v6 #5228

@fmbenhassine

Description

@fmbenhassine

Discussed in #5214

Originally posted by ctrung January 14, 2026
Hi,

With the new concurrency model of Spring Batch 6, ItemReader.read() is accessed by the main thread whereas it was accessed by the threads of the taskExecutor before.

It seems that the reader doesn't need to be thread-safe anymore (I have verified that myself, and the behaviour is the same with or without a thread-safe reader).

Chapter https://docs.spring.io/spring-batch/reference/scalability.html#multithreadedStep of the reference documentation still mentions the need for a thread safe reader.

Are there other usecases where a thread-safe reader is still needed ?

My step definition :

var step = new StepBuilder("my_step", jobRepository)
                         .<I, O>chunk(5)
                         .transactionManeger(transactionManager)
                         .reader(reader)
                         .writer(writer)
                         .taskExecutor(taskExecutor)
                         .build();

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions