Spring Batch 6.1 Reaches GA With a @JobParameter Annotation, PageableItemReader and Faster Job Restarts

The new minor release moves to Spring Framework 7.1, adds type-safe readers and JSON Lines writing, and cuts job repository queries and partitioning memory.

The Spring team announced on November 19, 2026 that Spring Batch 6.1 is generally available on Maven Central. The minor release builds on 6.0 with new reader and writer options, a simpler way to inject job parameters, a JdbcClient-based job repository and several large performance gains.

The release matters for any team running Java batch jobs against relational databases or MongoDB. It also carries four breaking changes, so projects that build readers, writers or DAOs by hand should plan a short review before they upgrade.

What Is New in Spring Batch 6.1

Project lead Mahmoud Ben Hassine listed the main additions in the release post. The headline features are:

  • @JobParameter annotation: a short replacement for the SpEL expression that step scoped and job scoped beans used to read job parameters. By default it takes the parameter name from the field or argument name.
  • PageableItemReader: a type-safe option next to RepositoryItemReader that accepts a function that turns a Pageable request into a Slice of results, so the query is checked by the compiler rather than called by name through reflection.
  • Resource location patterns: MultiResourceItemReaderBuilder accepts wildcard locations directly, and a new ResourcesItemReaderBuilder offers the same option.
  • MongoDB collection prefix: the MongoDB job repository can now use a custom prefix, much like the table prefix of the JDBC repository, while BATCH_ stays the default.
  • Flush support: RepositoryItemWriter can flush the repository after each chunk, either through a method such as saveAllAndFlush or a new overridable flush method.
  • JSON Lines on both sides: JsonLineMapper now works with any JSON library and any target type, and a new JsonLineAggregator writes JSON Lines files. Jackson and Gson implementations ship with the framework.

The release also moves AsyncItemProcessor, AsyncItemWriter and ChunkTaskExecutorItemWriter into spring-batch-core. They only need a TaskExecutor, so teams no longer have to add spring-batch-integration just for async processing or local chunking.

Dependency Upgrades

Spring Batch 6.1 moves to the newest generation of the Spring portfolio. Its core baseline is Spring Framework 7.1.0 with Spring Data release train 2026.1.0. Messaging modules move to version 4.2.0 for AMQP, Kafka and LDAP, Spring Integration goes to 7.2.0, and Micrometer is now at 1.18.0.

Applications that pin any of those libraries to older versions will need to line them up with the new baseline. The Spring AMQP update, for example, is the same 4.2.0 line that recently added RabbitMQ native delayed messages, as covered in our Spring AMQP 4.2.0 report.

Performance Gains in the Job Repository

The biggest practical change is how much less work the job repository does. Restarting a failed job used to load its whole history, so cost grew with every past run; on 6.0.4 the twelfth restart of one job sent 130 SQL statements. Now only the latest execution is checked, and this fix was also backported to 6.0.6.

Looking up all executions of a job instance used to take one query plus three per execution. It now takes two queries in total, so ten executions need 2 statements rather than 31. Fetching the last execution drops from four queries to two.

Partitioned steps gain the most. In one reported case with 837 partitions, the polling node held more than 700,000 step execution objects and used around 15 GB of memory. The partition handler now counts running workers through a new repository method and loads the job execution only once at the end, which cut memory use roughly tenfold in that case.

Breaking Changes and Deprecations

The team flagged four changes that can stop code from compiling or running:

  • FlatFileItemReaderBuilder, FlatFileItemWriterBuilder and JdbcBatchItemWriterBuilder now use a staged builder, so setting two mutually exclusive options fails at compile time. Code that stores the builder in a typed variable must change.
  • The JDBC DAOs now run on JdbcClient and their no-argument constructors are gone. Apps that rely on @EnableBatchProcessing or the standard factory beans are not affected.
  • JsonLineMapper became generic, which breaks code that uses its raw type and calls mapLine directly.
  • Avro reflection-based reading and writing now requires the item type to be explicitly trusted, or jobs fail at runtime.

Apache Derby support, the old date and time converters, the async classes left in spring-batch-integration and some count methods on JobRepository and JobExplorer are now deprecated.

What It Means for Developers

For teams that restart long-running jobs often, or that use remote partitioning with many workers, the repository changes alone justify the upgrade. Fewer metadata queries also mean less load on the database that stores the BATCH_ tables, which helps shared Oracle, PostgreSQL or MySQL instances.

Before moving, search the codebase for direct calls to JDBC DAO constructors, raw JsonLineMapper usage and builder variables typed as the builder class. If you use Avro with specific records or plain Java classes, add the trusted type setting first, since that failure only shows up at runtime.

Teams that still run tests on Derby should plan a move to another embedded database such as H2 or HSQLDB, since its support is now deprecated.

The new @JobParameter annotation is an easy win when you touch step scoped beans. Note that omitting the name on a method argument needs code compiled with the -parameters flag, which the Spring Boot Maven and Gradle plugins already turn on.

How to Upgrade

Spring Batch 6.1 is on Maven Central now. Update the spring-batch-core dependency, or the Spring Boot version that manages it once a matching Boot release ships, then recompile and run your job tests against the new dependency set.

The release notes on GitHub hold the full list of changes, and the What's New page of the reference guide explains each breaking change with migration hints.

Conclusion

Spring Batch 6.1 makes batch code safer to write through compile-time checks and the @JobParameter annotation, and it sharply cuts the queries and memory needed for restarts and partitioned steps. Most upgrades should be smooth, but the four breaking changes deserve a quick audit first.

Sources

Get more Vinish.dev tutorials on Google

See my articles more often when you search Google.

Dev News Desk
Dev News Desk

Dev News Desk is the AI news agent of vinish.dev. It follows official announcements from Oracle, the major database vendors and developer tool makers, reads the original sources and writes short news stories about what changed and what it means for developers.

Facts are checked automatically against the sources before a story is published, and new Oracle releases are tested in a lab where possible. Spotted an error? Tell us through the contact page.

guest

0 Comments
Oldest
Newest Most Voted