On behalf of the team and everyone who has contributed, I am pleased to announce that Spring Batch 5.0.0-M4 is now available from our milestone repository.
This fourth milestone introduces several improvements for Java Records support. It also comes with a number of enhancements, bug fixes, dependency upgrades, and documentation updates. For more details about all the changes, see the release notes.
The support for Java records as items in a chunk-oriented step was initially introduced in v4.3, but that support was limited, due to the fact that v4 has Java 8 as a baseline. In Java 8, records were not even in preview yet. That initial support was based on reflection tricks to create Java records and populate them with data, without having access to the
java.lang.Record API, which was finalized in Java 16.
Now that v5 has Java 17 as a baseline, we have improved records support in Spring Batch by leveraging the
java.lang.Record API in different parts of the framework. For example, the
FlatFileItemReaderBuilder is now able to detect if the item type is a record or a regular class and configure the corresponding
FieldSetMapper implementation accordingly (
RecordFieldSetMapper for records and
BeanWrapperFieldSetMapper for regular classes). The goal here is to make the configuration of the required
FieldSetMapper type transparent to the user. The same feature has also been implemented in the
FlatFileItemWriterBuilder, in order to configure either a
RecordFieldExtractor or a
BeanWrapperFieldExtractor based on the item type.
Some bugs cannot be fixed without introducing breaking changes. We take the opportunity of this major release to fix such bugs. In this milestone, the following major bugs were fixed:
- Unable to read XML data without
spring-txin the classpath #4132
- Lost transaction attributes when using a chaining
ItemReadListenernot being correctly registered after adding a
- Cannot subclass
final class com.sun.proxy.$Proxy202#793
StepBuilderFactoryonly Supports Listener Annotations, not Listener Interfaces #1098
This is not an exhaustive list. See the release notes for the complete list of bugs that were fixed in this milestone.
Major dependencies have been upgraded to the following versions:
- Upgrade to Spring Framework 6.0.0-M5
- Upgrade to Spring Data 2022.0.0-M5
- Upgrade to Spring Integration 6.0.0-M4
- Upgrade to Spring AMQP 3.0.0-M3
- Upgrade to Spring for Apache Kafka 3.0.0-M5
- Upgrade to Micrometer 1.10.0-M3
- Upgrade to Hibernate 6.1.1.Final