Add spring-batch-partitioning: manager/worker partitioning, gridSize semantics, rejected-partition recovery, and a real 10M-row scaling sweep
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# Overloading a @Bean method across mutually-exclusive @Profile beans: rejected at startup
|
||||
|
||||
First draft of the two TaskExecutor beans in BatchConfig used the same method name,
|
||||
`partitionTaskExecutor`, distinguished only by @Profile("!reject") / @Profile("reject").
|
||||
Spring Framework 7's @Configuration.enforceUniqueMethods (on by default) does not know the two
|
||||
profiles are mutually exclusive at class-parsing time -- it only sees one method name declared
|
||||
twice -- and refuses to start:
|
||||
|
||||
$ java -jar target/spring-batch-partitioning-1.0.0.jar --partition.shards-dir=./data/shards-small
|
||||
...
|
||||
2026-09-14T09:06:49.013Z WARN 2629 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: @Configuration class 'BatchConfig' contains overloaded @Bean methods with name 'partitionTaskExecutor'. Use unique method names for separate bean definitions (with individual conditions etc) or switch '@Configuration.enforceUniqueMethods' to 'false'.
|
||||
Offending resource: class path resource [com/ankurm/batchpartition/config/BatchConfig.class]
|
||||
|
||||
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: @Configuration class 'BatchConfig' contains overloaded @Bean methods with name 'partitionTaskExecutor'. Use unique method names for separate bean definitions (with individual conditions etc) or switch '@Configuration.enforceUniqueMethods' to 'false'.
|
||||
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:71) ~[spring-beans-7.0.9.jar!/:7.0.9]
|
||||
at org.springframework.context.annotation.ConfigurationClass.validate(ConfigurationClass.java:265) ~[spring-context-7.0.9.jar!/:7.0.9]
|
||||
at org.springframework.context.annotation.ConfigurationClassParser.validate(ConfigurationClassParser.java:230) ~[spring-context-7.0.9.jar!/:7.0.9]
|
||||
|
||||
The message is accurate and the fix it suggests (unique method names) is the right one -- this
|
||||
module's fixed version names the two beans partitionTaskExecutor() and
|
||||
partitionTaskExecutorRejecting(int). The point worth recording: this is NOT a Spring Batch 6
|
||||
change, it is a Spring Framework 7 @Configuration default that bites a pattern (profile-gated
|
||||
@Bean overloads) that plenty of Spring Batch 5.x tutorials use freely.
|
||||
Reference in New Issue
Block a user