Adapt to breaking transaction manager change in Spring Batch

See gh-32237
See spring-projects/spring-batch#4130
This commit is contained in:
Andy Wilkinson 2022-09-08 14:51:03 +01:00
parent 0f9ff867e7
commit 5352468bcc
1 changed files with 6 additions and 1 deletions

View File

@ -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()
}
}