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

@@ -29,6 +29,7 @@ import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.PlatformTransactionManager;
/**
* @author Michael Minella
@@ -44,6 +45,9 @@ public class JobConfiguration {
@Autowired
public StepBuilderFactory stepBuilderFactory;
@Autowired
public PlatformTransactionManager transactionManager;
@Bean
public Job job1() {
return this.jobBuilderFactory.get("job1").start(this.stepBuilderFactory.get("job1step1").tasklet(new Tasklet() {
@@ -52,7 +56,7 @@ public class JobConfiguration {
logger.info("Job1 was run");
return RepeatStatus.FINISHED;
}
}).build()).build();
}).transactionManager(transactionManager).build()).build();
}
}