Updated readers and writers to set platform transaction

It is no longer provided by default by the job builder.

https://github.com/spring-projects/spring-batch/wiki/Spring-Batch-5.0-Migration-Guide#infrastructure-beans-configuration-with-enablebatchbatchprocessing
This commit is contained in:
Glenn Renfro
2022-09-08 19:15:55 -04:00
parent 02f4581f32
commit 87632b3487
19 changed files with 187 additions and 28 deletions

View File

@@ -38,6 +38,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.task.configuration.EnableTask;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.PlatformTransactionManager;
@EnableTask
@SpringBootApplication
@@ -59,6 +60,9 @@ public class BatchEventsApplication {
@Autowired
private StepBuilderFactory stepBuilderFactory;
@Autowired
private PlatformTransactionManager transactionManager;
@Bean
public Step step1() {
return this.stepBuilderFactory.get("step1").tasklet(new Tasklet() {
@@ -67,7 +71,7 @@ public class BatchEventsApplication {
System.out.println("Tasklet has run");
return RepeatStatus.FINISHED;
}
}).build();
}).transactionManager(transactionManager).build();
}
@Bean
@@ -86,7 +90,7 @@ public class BatchEventsApplication {
System.out.println(">> " + item);
}
}
}).build();
}).transactionManager(transactionManager).build();
}
@Bean