Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreI am pleased to announce that Spring Batch 4.3.0-RC1 is now available from our milestone repository.
This release comes with a number of new features that you can find in the release notes, but here are the major highlights:
A lot of work has already been done in Spring Framework to support running some types of Spring applications on GraalVM. In this release, we made changes in Spring Batch to correctly run Batch applications on GraalVM as well.
The support is still experimental, so we encourage you to give the release a try and share your feedback.
Records have been introduced in Java 14 and reviewed in Java 15, which was released a few days ago. In this release, we added support for using Java records as items in chunk-oriented steps. The following example shows how to use records to read data from a flat file. Consider the following persons.csv
file and Person
record:
id,name
1,William Shakespeare
2,Anne Hathaway
public record Person(int id, String name) { }
The following FlatFileItemReader
bean definition enables reading data into record items:
@Bean
public FlatFileItemReader<Person> itemReader() {
return new FlatFileItemReaderBuilder<Person>()
.name("personReader")
.resource(new FileSystemResource("persons.csv"))
.delimited()
.names("id", "name")
.fieldSetMapper(new RecordFieldSetMapper<>(Person.class))
.build();
}
The key component in this example is the newly added RecordFieldSetMapper
to support data mapping for records from flat files. You can do data mapping from relational databases by using the DataClassRowMapper
from Spring Framework.
JpaCursorItemReader
ImplementationJPA 2.2 added the ability to stream results as a cursor instead of only paging. In this release, we introduced a new JPA item reader that uses this feature to stream results in a cursor-based fashion similar to the JdbcCursorItemReader
and HibernateCursorItemReader
.
This release upgrades Spring projects dependencies to the following versions:
You can consume Spring Batch v4.3.0-RC1 with Spring Boot 2.4.0-M3.
As we announced earlier this year, version 4.3 will be the last feature release of the version 4 line. In this release, we took the opportunity to deprecate some APIs for removal in the next major version, version 5.
The most notable change in this release is the deprecation of the Map-based JobRepository
and JobExplorer
implementations. You can find more details about the motivations behind this decision in issue #3780.
I would like to thank all contributors who made this release possible! We look forward to your feedback on this milestone on Twitter, StackOverflow, and Github.
Spring Batch Home | Source on GitHub | Reference Documentation