During Spring Batch migration from 4.x to 5.0.3, I am facing issue related to initializing spring Batch table: BATCH_JOB_INSTANCE.
I have mostly followed Spring Batch 5.0 migration Guide: My BatchConfiguration class:
@Configuration
public class BatchConfiguration {
@Bean
public Job reportGenerationJob(JobRepository jobRepository,Step step5,Step step6) throws Exception{
log.info(">>>>>Inside Job reportGenerationJob");
return new JobBuilder("reportGenerationJob",jobRepository)
.incrementer(new RunIdIncrementer())
.start(step5).on("*").to(step6)
.end()
.build();
}
/*
* Step to read all records from DB,process original Transactions from FUF and add them to a list
*/
@Bean
public Step step5(JobRepository jobRepository, PlatformTransactionManager transactionManager) throws ParseException {
log.info(">>>>>Inside Step 5");
return new StepBuilder("step5", jobRepository)
.<TSRequest, OriginalTransaction> chunk(20,transactionManager)
.reader(transactionReader())
.processor(transactionCsvProcessor())
.writer(new SavingOriginalTransactionListWriter<>(originalTransactions))
.build();
}
@Bean
public Step step6(JobRepository jobRepository, Tasklet creatingSingleOutputPtmTransactions, PlatformTransactionManager transactionManager) {
log.info(">>>>>Inside Step 6");
return new StepBuilder("step6", jobRepository)
.tasklet(creatingSingleOutputPtmTransactions(),transactionManager)
.build();
}
}