From 5352468bcc2564a3486debd02466fa7c02bd98c7 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 8 Sep 2022 14:51:03 +0100 Subject: [PATCH] Adapt to breaking transaction manager change in Spring Batch See gh-32237 See spring-projects/spring-batch#4130 --- spring-boot-project/spring-boot-cli/samples/job.groovy | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-cli/samples/job.groovy b/spring-boot-project/spring-boot-cli/samples/job.groovy index f5b8b392dc..04c0777ebc 100644 --- a/spring-boot-project/spring-boot-cli/samples/job.groovy +++ b/spring-boot-project/spring-boot-cli/samples/job.groovy @@ -1,5 +1,7 @@ package org.test +import org.springframework.transaction.TransactionManager + @Grab("hsqldb") @Configuration(proxyBeanMethods = false) @EnableBatchProcessing @@ -10,6 +12,9 @@ class JobConfig { @Autowired private StepBuilderFactory steps + + @Autowired + private TransactionManager transactionManager @Bean protected Tasklet tasklet() { @@ -28,6 +33,6 @@ class JobConfig { @Bean protected Step step1() throws Exception { - return steps.get("step1").tasklet(tasklet()).build() + return steps.get("step1").tasklet(tasklet()).transactionManager(this.transactionManager).build() } }