Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Spring Batch 5.0 Delivers JDK 17 Baseline and Support for Native Java

Spring Batch 5.0 Delivers JDK 17 Baseline and Support for Native Java


VMware has released Spring Batch 5.0. Baselined to Java 17 and the latest Spring Framework 6.0, Spring Batch now supports GraalVM native image, a new Observation API, Java Records, and a long list of enhancements and fixes made by more than 50 contributors.

Spring Batch 5 depends on Spring Framework 6, Spring Integration 6, Spring Data 3, Spring AMQP 3, and Micrometer 1.10. Furthermore, import statements require a migration from the javax.* to jakarta.* namespaces for all usage of the Jakarta EE APIs since this version marks the migration to Jakarta EE 9. Spring Batch now also uses Hibernate 6 for cursor and paging item readers.

Spring Batch 5 introduces a new class, DefaultBatchConfiguration, as an alternative to the @EnableBatchProcessing annotation. It provides all infrastructure beans with default configuration, which users can customize. Users can now specify a transaction manager and can customize its transaction attributes using the JobExplorer interface. The latest release also provides enhancements to better leverage the Record API in the framework, as support for the Record API was first introduced in Spring Batch 4. Spring Batch also extends support for SAP HANA and full support for MariaDB.

The @EnableBatchProcessing annotation no longer exposes a transaction manager bean in the application context. This is good news for user-defined transaction managers as it avoids unconditional behavior as in previous versions. Users must manually configure the transaction manager on any tasklet step definition to avoid inconsistency between XML and Java configuration styles. The @EnableBatchProcessing annotation also configures a JDBC-based JobRepository interface. VMware recommends using embedded databases to work with in-memory job repositories.

Micrometer upgrades to version 1.10, allowing users to get Batch tracing and Batch metrics. Spring Batch now also creates a span for each job and step. The data is viewable in distributed tracing tools like Zipkin.

Another refreshing change is handling job parameters using the JobParameter class. This way, users are no longer restricted to the long, double, string, or date types as they were in version 4. This change has an impact on how parameters persist in the database.

Spring Batch 5 also removes support for SQLFire, JSR-352 (Batch Applications for the Java Platform), and GemFire.

About the Author

Rate this Article