Add @EnableJdbcJobRepository alongside @EnableBatchProcessing
io.moderne.java.spring.batch.AddEnableJdbcJobRepositoryio.moderne.recipe:rewrite-springIn Spring Batch 6, @EnableBatchProcessing no longer configures a JDBC-based JobRepository on its own: the JDBC store configuration moved to a new @EnableJdbcJobRepository annotation, and a bare @EnableBatchProcessing now registers an in-memory ResourcelessJobRepository. This recipe adds @EnableJdbcJobRepository next to every @EnableBatchProcessing so JDBC-backed persistence is preserved, moving the JDBC-specific attributes (dataSourceRef, tablePrefix, etc.) to the new annotation, copying transactionManagerRef to it (kept on @EnableBatchProcessing as well), converting isolationLevelForCreate from its Spring Batch 5 String form to the Isolation enum, and dropping the removed lobHandlerRef attribute. Classes that already declare @EnableJdbcJobRepository or @EnableMongoJobRepository, and programmatic DefaultBatchConfiguration subclasses, are left unchanged. A non-literal isolationLevelForCreate value is left in place for manual migration.
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe io.moderne.java.spring.batch.AddEnableJdbcJobRepositoryIf the recipe isn’t available locally, install it with:
mod config recipes jar install io.moderne.recipe:rewrite-spring:0.39.0Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats