This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Batch Documentation 5.1.2!spring-doc.cn

This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Batch Documentation 5.1.2!spring-doc.cn

Dependencies upgrade

In this release, the Spring dependencies are upgraded to the following versions:spring-doc.cn

Query hints support in JPA item readers

Up until version 5.1, the JPA cursor and paging item readers did not support query hints (like the fetch size, timeout, etc). Users were required to provide a custom query provider in order to specify custom hints.spring-doc.cn

In this release, JPA readers and their respective builders were updated to accept query hints when defining the JPA query to use.spring-doc.cn

Data class support in JDBC item readers

This release introduces a new method in the builders of JDBC cursor and paging item readers that allows users to specify a DataClassRowMapper when the type of items is a data class (Java record or Kotlin data class).spring-doc.cn

The new method named dataRowMapper(TargetType.class) is similar to the beanRowMapper(TargetType.class) and is designed to make the configuration of row mappers consistent between regular classes (Java beans) and data classes (Java records).spring-doc.cn

Configurable line separator in RecursiveCollectionLineAggregator

Up until now, the line separator property in RecursiveCollectionLineAggregator was set to the System’s line separator value. While it is possible to change the value through a System property, this configuration style is not consistent with other properties of batch artifacts.spring-doc.cn

This release introduces a new setter in RecursiveCollectionLineAggregator that allows users to configure a custom value of the line separator without having to use System properties.spring-doc.cn

Job registration improvements

In version 5.1, the default configuration of batch infrastructure beans was updated to automatically populate the job registry by defining a JobRegistryBeanPostProcessor bean in the application context. After a recent change in Spring Framework that changed the log level in BeanPostProcessorChecker, several warnings related to the JobRegistryBeanPostProcessor were logged in a typical Spring Batch application. These warnings are due to the JobRegistryBeanPostProcessor having a dependency to a JobRegistry bean, which is not recommended and might cause bean lifecycle issues.spring-doc.cn

These issues have been resolved in this release by changing the mechanism of populating the JobRegistry from using a BeanPostProcessor to using a SmartInitializingSingleton. The JobRegistryBeanPostProcessor is now deprecated in favor of the newly added JobRegistrySmartInitializingSingleton.spring-doc.cn