Skip to content

Instantly share code, notes, and snippets.

@mminella
Created July 12, 2019 17:38
Show Gist options
  • Save mminella/3437f89aa6ca85c6f94bd7772ed498a2 to your computer and use it in GitHub Desktop.
Save mminella/3437f89aa6ca85c6f94bd7772ed498a2 to your computer and use it in GitHub Desktop.
Bean With Listener
@Bean
public Step step1() {
return this.stepBuilderFactory.get("step1")
.<Integer, Integer>chunk(10)
.reader(new ListItemReader<>(IntStream.rangeClosed(0, this.random.nextInt(10000))
.boxed().collect(Collectors.toList())))
.writer(list -> list.forEach(System.out::println))
.listener(new StepExecutionListener() {
@Override
public void beforeStep(StepExecution stepExecution) {
}
@Override
public ExitStatus afterStep(StepExecution stepExecution) {
return null;
}
}).build();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment