Files

44 lines
3.2 KiB
Plaintext

# Spring Batch 6.0: the item/repeat infrastructure moved packages
Verified by decompiling the real jars pulled from Maven Central, not by reading prose.
--- Spring Batch 5.2.x (docs.spring.io javadoc, org.springframework.batch:spring-batch-infrastructure:5.2.6) ---
Package: org.springframework.batch.item
Class: org.springframework.batch.item.ExecutionContext
--- Spring Batch 6.0.5 (unzip -l spring-batch-infrastructure-6.0.5.jar) ---
$ unzip -l spring-batch-infrastructure-6.0.5.jar | grep -E "ExecutionContext.class|CompletionPolicy.class"
2908 2026-08-17 10:28 org/springframework/batch/infrastructure/repeat/policy/SimpleCompletionPolicy.class
3388 2026-08-17 10:28 org/springframework/batch/infrastructure/repeat/policy/CompositeCompletionPolicy.class
1179 2026-08-17 10:28 org/springframework/batch/infrastructure/repeat/policy/DefaultResultCompletionPolicy.class
2934 2026-08-17 10:28 org/springframework/batch/infrastructure/repeat/policy/CountingCompletionPolicy.class
718 2026-08-17 10:28 org/springframework/batch/infrastructure/repeat/CompletionPolicy.class
7922 2026-08-17 10:28 org/springframework/batch/infrastructure/item/ExecutionContext.class
Every class under the old org.springframework.batch.item.* and org.springframework.batch.repeat.*
now lives under org.springframework.batch.infrastructure.item.* and
org.springframework.batch.infrastructure.repeat.* -- ItemReader, ItemWriter, ItemProcessor,
ExecutionContext, RepeatStatus, CompletionPolicy, every FlatFileItemReaderBuilder and
JdbcBatchItemWriterBuilder, all of it. A 5.x guide's imports do not compile against 6.0 for this
reason alone, before any API shape has changed at all.
--- Partitioner interface, decompiled from spring-batch-core-6.0.5.jar ---
$ javap org/springframework/batch/core/partition/Partitioner.class
Compiled from "Partitioner.java"
public interface org.springframework.batch.core.partition.Partitioner {
public abstract java.util.Map<java.lang.String, org.springframework.batch.infrastructure.item.ExecutionContext> partition(int);
}
Note the return type: Map<String, org.springframework.batch.infrastructure.item.ExecutionContext>.
Any 5.x Partitioner implementation that imports org.springframework.batch.item.ExecutionContext
fails to compile against 6.0 with "cannot find symbol" on that single import line -- the fix is a
one-line import change, but the error message does not say that; it just says the type does not
exist, which sends most people straight to a search engine instead of to the correct one-line fix.
--- Two more classes that moved, found while writing this module's beans ---
org.springframework.batch.core.job.parameters.JobParametersBuilder (was org.springframework.batch.core.JobParametersBuilder)
org.springframework.batch.core.repository.explore.JobExplorer (was org.springframework.batch.core.explore.JobExplorer)
org.springframework.batch.core.scope.context.StepSynchronizationManager (NOT org.springframework.batch.core.step -- BatchConfig's
first draft guessed that package for reading the current partition's step name inside an
ItemWriter and failed to compile; see docs/04-the-writer-and-the-beanmapped-trap.md)