Skip to content

Commit bb7a95a

Browse files
fmbenhassinesnicoll
authored andcommitted
Adapt Batch sample to latest changes in transaction management
See spring-projects/spring-batch#4130 See gh-110
1 parent 01bc933 commit bb7a95a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

batch/src/main/java/com/example/batch/BatchConfiguration.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.springframework.batch.repeat.RepeatStatus;
99
import org.springframework.context.annotation.Bean;
1010
import org.springframework.context.annotation.Configuration;
11+
import org.springframework.transaction.PlatformTransactionManager;
1112

1213
@Configuration(proxyBeanMethods = false)
1314
@EnableBatchProcessing
@@ -19,11 +20,11 @@ public Job job(JobBuilderFactory jobBuilderFactory, Step step1) {
1920
}
2021

2122
@Bean
22-
public Step step1(StepBuilderFactory stepBuilderFactory) {
23+
public Step step1(StepBuilderFactory stepBuilderFactory, PlatformTransactionManager transactionManager) {
2324
return stepBuilderFactory.get("step1").tasklet((stepContribution, chunkContext) -> {
2425
System.out.println("Step 1 running");
2526
return RepeatStatus.FINISHED;
26-
}).build();
27+
}).transactionManager(transactionManager).build();
2728
}
2829

2930
}

0 commit comments

Comments
 (0)