Migrate to Spring Batch 5.0 from 4.3

MSAL

Migrate applications built on Spring Batch 4.3 to the latest Spring Batch 5.0 release.

org.openrewrite.java.spring.batch.SpringBatch4To5Migration
mod run . --recipe=org.openrewrite.java.spring.batch.SpringBatch4To5Migration

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Upgrade Gradle or Maven dependency versions org.springframework.batch:*:5.0.x
  2. Transform classes that extend *ListenerSupport to implement the *Listener interfaces instead
  3. Migrate JobBuilderFactory to JobBuilder
  4. Migrate StepBuilderFactory to StepBuilder
  5. Add PlatformTransactionManager to tasklet() and chunk() calls
  6. Migrate ItemWriter
  7. Remove DefaultBatchConfigurer
  8. Change the type of skipCount parameter in SkipPolicy from int to long
  9. Change type org.springframework.batch.core.metrics.BatchMetrics to org.springframework.batch.core.observability.BatchMetrics
  10. Change type org.springframework.batch.core.step.item.Chunk to org.springframework.batch.item.Chunk
  11. Change type org.springframework.batch.core.configuration.annotation.ScopeConfiguration to org.springframework.batch.core.configuration.support.ScopeConfiguration
  12. Convert receive type in some invocation of StepExecution.xx()
  13. Migrate Date to LocalDateTime for Spring Batch timestamp methods
  14. Migrate JobParameter.toString() to JobParameter.getValue().toString()
  15. Add class argument to JobParameters
  16. Migrate method when it annotated by Spring Batch API