Spring Batch 4.3.0-RC1 available now!

Releases | Mahmoud Ben Hassine | September 17, 2020 | ...

I am pleased to announce that Spring Batch 4.3.0-RC1 is now available from our milestone repository.

What’s New?

This release comes with a number of new features that you can find in the release notes, but here are the major highlights:

1. GraalVM Support

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.

2. Java Records Support

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.

3. A New JpaCursorItemReader Implementation

JPA 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.

Dependency Upgrades

This release upgrades Spring projects dependencies to the following versions:

  • Spring Framework 5.3.0-RC1
  • Spring Data 2020.0.0-RC1
  • Spring Integration 5.4.0-M3
  • Spring AMQP 2.3.0-M3
  • Spring for Apache Kafka 2.6.1

You can consume Spring Batch v4.3.0-RC1 with Spring Boot 2.4.0-M3.

API Deprecation

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.

Feedback and Contributions

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

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