Closed
Description
Commit 219fee3 modified some code examples for the API introduced in v5. Some of those examples won't compile now.
See sections:
- https://docs.spring.io/spring-batch/docs/current/reference/html/step.html#commitInterval
- https://docs.spring.io/spring-batch/docs/current/reference/html/step.html#stepRestartExample
- ... maybe others?
Example:
@Bean
public Job sampleJob(JobRepository jobRepository) {
return new JobBuilder("sampleJob", jobRepository)
.start(step1())
.build();
}
@Bean
public Step step1(JobRepository jobRepository, PlatformTransactionManager transactionManager) {
return new StepBuilder("step1", jobRepository)
.<String, String>chunk(10, transactionManager)
.reader(itemReader())
.writer(itemWriter())
.build();
}
In the sampleJob
bean, there is a method call to step1()
. But as you see, it does not provide JobRepository and PlatformTransactionManager parameters.
To fix it, those parameters should be provided, or perhaps the sampleJob
method should autowire the step1
bean instead.