This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Boot 3.5.6!

Spring Batch

Spring Boot offers several conveniences for working with Spring Batch, including running a Job on startup.

If Spring Batch is available on your classpath, it is initialized through the @EnableBatchProcessing annotation.

When building a batch application, the following stores can be auto-configured:

  • In-memory

  • JDBC

Each store has specific additional settings. For instance, it is possible to customize the tables prefix for the JDBC store, as shown in the following example:

  • Properties

  • YAML

spring.batch.jdbc.table-prefix=CUSTOM_
spring:
  batch:
    jdbc:
      table-prefix: "CUSTOM_"

You can take control over Spring Batch’s configuration using @EnableBatchProcessing. This will cause the auto-configuration to back off. Spring Batch can then be configured using the @Enable*JobRepository annotation’s attributes rather than the previously described configuration properties.

Running Spring Batch Jobs on Startup

When Spring Boot auto-configures Spring Batch, and if a single Job bean is found in the application context, it is executed on startup (see JobLauncherApplicationRunner for details). If multiple Job beans are found, the job that should be executed must be specified using spring.batch.job.name.

You can disable running a Job found in the application context, as shown in the following example:

  • Properties

  • YAML

spring.batch.job.enabled=false
spring:
  batch:
    job:
      enabled: false