Identified depracations and updated the code

This commit is contained in:
Glenn Renfro
2023-03-20 14:01:45 -04:00
parent afc1b2ea9e
commit 4f0b68bd0b
8 changed files with 41 additions and 62 deletions

View File

@@ -60,19 +60,19 @@ public class BatchEventsApplication {
@Bean
public Step step1() {
return new StepBuilder("step1").repository(this.jobRepository).tasklet(new Tasklet() {
return new StepBuilder("step1", this.jobRepository).tasklet(new Tasklet() {
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
System.out.println("Tasklet has run");
return RepeatStatus.FINISHED;
}
}).transactionManager(transactionManager).build();
}, transactionManager).build();
}
@Bean
public Step step2() {
return new StepBuilder("step2").repository(this.jobRepository)
.<String, String>chunk(DEFAULT_CHUNK_COUNT)
return new StepBuilder("step2", this.jobRepository)
.<String, String>chunk(DEFAULT_CHUNK_COUNT, this.transactionManager)
.reader(new ListItemReader<>(Arrays.asList("1", "2", "3", "4", "5", "6")))
.processor(new ItemProcessor<String, String>() {
@Override
@@ -88,13 +88,12 @@ public class BatchEventsApplication {
}
}
})
.transactionManager(transactionManager)
.build();
}
@Bean
public Job job() {
return new JobBuilder("job").repository(this.jobRepository).start(step1()).next(step2()).build();
return new JobBuilder("job", this.jobRepository).start(step1()).next(step2()).build();
}
}