Migrate to Spring Batch 5.0 from 4.3
Recipe ID
org.openrewrite.java.spring.batch.SpringBatch4To5MigrationArtifact
org.openrewrite.recipe:rewrite-springMigrate applications built on Spring Batch 4.3 to the latest Spring Batch 5.0 release.
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.java.spring.batch.SpringBatch4To5MigrationIf the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-spring:6.36.0Definition
This recipe runs the following recipes in order.
- Upgrade Gradle or Maven dependency versions
org.openrewrite.java.dependencies.UpgradeDependencyVersion - Transform classes that extend
*ListenerSupportto implement the*Listenerinterfaces insteadorg.openrewrite.java.spring.batch.ListenerSupportClassToInterface - Migrate
JobBuilderFactorytoJobBuilderorg.openrewrite.java.spring.batch.MigrateJobBuilderFactory - Migrate
StepBuilderFactorytoStepBuilderorg.openrewrite.java.spring.batch.MigrateStepBuilderFactory - Add
PlatformTransactionManagertotasklet()andchunk()callsorg.openrewrite.java.spring.batch.AddTransactionManagerToTaskletAndChunk - Migrate
ItemWriterorg.openrewrite.java.spring.batch.MigrateItemWriterWrite - Remove
DefaultBatchConfigurerorg.openrewrite.java.spring.batch.RemoveDefaultBatchConfigurer - Change the type of
skipCountparameter inSkipPolicyfrominttolongorg.openrewrite.java.spring.batch.UpgradeSkipPolicyParameterType - Change type
org.openrewrite.java.ChangeType - Change type
org.openrewrite.java.ChangeType - Change type
org.openrewrite.java.ChangeType - Convert receive type in some invocation of StepExecution.xx()
org.openrewrite.java.spring.batch.ConvertReceiveTypeWhenCallStepExecutionMethod - Migrate
DatetoLocalDateTimefor Spring Batch timestamp methodsorg.openrewrite.java.spring.batch.MigrateStepExecutionTimestampTypes - Migration invocation of JobParameter.toString to JobParameter.getValue.toString
org.openrewrite.java.spring.batch.JobParameterToString - Add class argument to
JobParametersorg.openrewrite.java.spring.batch.MigrateJobParameter - Migrate method when it annotated by Spring Batch API
org.openrewrite.java.spring.batch.MigrateMethodAnnotatedByBatchAPI - Change type
org.openrewrite.java.ChangeType
Data 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