Spring Batch 5.1.0-M3 available now!

On behalf of the team and everyone who has contributed, I am pleased to announce that Spring Batch 5.1.0-M3 is now available from our milestone repository.

This new milestone introduces the following main features:

  • Dependencies upgrade
  • New item reader and writer for Redis
  • Automatic configuration of JobRegistryBeanPostProcessor
  • Ability to start a job flow with a decision
  • Ability to provide a custom JobKeyGenerator
  • New documentation based on Antora

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

Dependencies upgrade

This milestone release upgrades Spring dependencies to the following versions:

  • Spring Framework 6.1.0-M5
  • Spring Integration 6.2.0-M3
  • Spring Data 3.2.0-M3
  • Spring LDAP 3.2.0-M3
  • Spring AMQP 3.1.0-M1
  • Spring Kafka 3.1.0-M1
  • Micrometer 1.12.0-M3

New item reader and writer for Redis

A typical case of using Redis within the context of Spring Batch is populating/clearing a cache with reference data before/after a job execution. This is a common performance improvement pattern that is useful to query data from the cache instead of issuing multiple queries to the main database during the execution of the job.

In this milestone release, a new RedisItemReader and RedisItemWriter based on Spring Data Redis have been introduced in the library of built-in item readers and writers. The reader can be configured with a ScanOptions to scan the key set to read from Redis. The writer is configurable with a RedisTemplate to write items to Redis.

Automatic configuration of JobRegistryBeanPostProcessor

When configuring a JobOperator in a Spring Batch application, it is necessary to register the jobs in the operator’s JobRegistry. This registration process is either done manually or automatically by adding a JobRegistryBeanPostProcessor bean to the application context.

In this milestone release, the default configuration of Spring Batch (ie when using @EnableBatchProcessing or extending DefaultBatchConfiguration) now automatically registers a JobRegistryBeanPostProcessor bean in the application context. This simplifies the configuration process and improves the user experience when using a JobOperator.

Ability to start a job flow with a decision

When using the XML configuration style, it is possible to start a job flow with a decider thanks to the decision element. However, up to version 5.0, it was not possible to achieve the same flow definition with the Java API.

This milestone release adds a new option to the JobBuilder API to start a job flow with a JobExecutionDecider. This makes both configuration styles more consistent.

Ability to provide a custom JobKeyGenerator

By default, Spring Batch identifies job instances by calculating a hash of the identifying job parameters. While it is unlikely to need to customize this identification process, Spring Batch still provides a strategy interface for users to override the default mechanism through the JobKeyGenerator API.

Up to version 5.0, it was not possible to provide a custom key generator without having to create a custom JobRepository and JobExplorer. In this version, it is now possible to provide a custom JobKeyGenerator through the factory beans of JobRepository and JobExplorer.

New documentation based on Antora

The reference documentation was updated to use Antora. This update introduces a number of improvements, including but not limited to:

  • Multi-version documentation: it is now possible to navigate from one version to another thanks to the drop down version list in the left side menu.
  • Integrated search experience: powered by Algolia, the search experience in now better thanks to the integrated search box at the top left of the page
  • Improved configuration style toggle: the toggle to switch between the XML and Java configuration styles for code snippets is now located near each sample, rather than the top of each page

You can check the new documentation version here.

What’s next?

Share your feedback!

First, I would like to thank all contributors who had a role in this release! You can try Spring Batch 5.1.0-M3 with Spring Boot 3.2.0-M3. We are planning to release Spring Batch 5.1 GA later this November 2023.

We look forward to your feedback on Github Issues, Github Discussions, Twitter, and StackOverflow.

Upgrade to Spring Batch 5

I would like to remind our users that Spring Batch 4.3.x will be out of OSS support on November, 18th 2023. Please consider upgrading your applications to Spring Batch 5 at your earliest convenience. You can find the migration guide to v5 here.

Feel free to reach out to the Spring Batch team on Github if you need help on migrating your existing applications to Spring Batch 5!

Spring Batch Home|Source on Github|Reference documentation

点赞4 分享
评论 抢沙发