Spring Batch 6.0.0-M2 available now

Releases | Mahmoud Ben Hassine | August 20, 2025 | ...

I am pleased to announce that Spring Batch 6.0.0-M2 is available now from Maven Central!

In this milestone release, we shipped the following features and improvements:

  • Dependencies upgrade
  • New implementation of the chunk-oriented processing model
  • Ability to recover abruptly failed job executions

For the complete list of changes, please check the release notes.

Dependencies upgrade

In this milestone release, the Spring dependencies are upgraded to the following versions:

  • Spring Framework: 7.0.0-M8
  • Spring Integration: 7.0.0-M2
  • Spring AMQP: 4.0.0-M4
  • Spring Kafka: 4.0.0-M4
  • Spring Data: 4.0.0-M5
  • Spring Ldap: 4.0.0-M2
  • Micrometer: 1.16.0-M2

Please note that this release is compatible with Java 17+.

New implementation of the chunk-oriented processing model

This is not a new feature, but rather a new, enhanced implementation of the chunk-oriented processing model. This new implementation was introduced as an experimental addition in version 5.1, and is now available as stable in version 6.0.

The new implementation is provided in the ChunkOrientedStep class, which is a replacement for the ChunkOrientedTasklet / TaskletStep classes.

Here is an example of how to define a ChunkOrientedStep by using its builder:

@Bean
public Step chunkOrientedStep(JobRepository jobRepository, JdbcTransactionManager transactionManager,
    ItemReader<Person> itemReader, ItemProcessor<Person, Person> itemProcessor, ItemWriter<Person> itemWriter) {
    
    int chunkSize = 100;
    return new ChunkOrientedStepBuilder<Person, Person>(jobRepository, transactionManager, chunkSize)
        .reader(itemReader)
        .processor(itemProcessor)
        .writer(itemWriter)
        .build();
}

Moreover, fault-tolerance features were adapted as follows:

  • The retry feature is now based on the retry functionality introduced in Spring Framework 7, instead of the previous Spring Retry library
  • The skip feature has been slightly adapted to the new implementation, which is now entirely based on the SkipPolicy interface

Here is a quick example of how to use the retry and skip features with the new ChunkOrientedStep:

@Bean
public Step faulTolerantChunkOrientedStep(JobRepository jobRepository, JdbcTransactionManager transactionManager,
    ItemReader<Person> itemReader, ItemProcessor<Person, Person> itemProcessor, ItemWriter<Person> itemWriter) {

    // retry policy configuration
    int maxAttempts = 10;
    var retrybaleExceptions = Set.of(TransientException.class);
    RetryPolicy retryPolicy = RetryPolicy.builder()
        .maxAttempts(maxAttempts)
        .includes(retrybaleExceptions)
        .build();

    // skip policy configuration
    int skipLimit = 50;
    var skippableExceptions = Set.of(FlatFileParseException.class);
    SkipPolicy skipPolicy = new LimitCheckingItemSkipPolicy(skipLimit, skippableExceptions);

    // step configuration
    int chunkSize = 100;
    return new ChunkOrientedStepBuilder<Person, Person>(jobRepository, transactionManager, chunkSize)
        .reader(itemReader)
        .processor(itemProcessor)
        .writer(itemWriter)
        .faultTolerant()
        .retryPolicy(retryPolicy)
        .skipPolicy(skipPolicy)
        .build();
}

Please refer to the migration guide for more details on how to migrate from the previous implementation to the new one.

Ability to recover failed job executions

Prior to v6, if a job execution fails abruptly, it was not possible to recover it without a manual database update. This was error-prone and not consistent across different job repositories (as it required a few SQL statements for JDBC databases and some custom statements for NoSQL stores).

This milestone release introduces a new method named recover in the JobOperator interface that allows you to recover failed job executions consistently across all job repositories.

Feedback

I would like to thank all contributors who had a role in this release! As we continue our work on Spring Batch 6, we look forward to your feedback on Github Issues, Github Discussions and X.


Spring Batch Home|Source on Github|Reference documentation

Get the Spring newsletter

Stay connected with the Spring newsletter

Subscribe

Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all