Spring Boot/Spring Batch 목표 아키텍처 정의 #4
1 changed files with 38 additions and 0 deletions
38
src/main/java/com/example/demo/job/TransactionJobConfig.java
Normal file
38
src/main/java/com/example/demo/job/TransactionJobConfig.java
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.example.demo.job;
|
||||||
|
|
||||||
|
import org.springframework.batch.core.Job;
|
||||||
|
import org.springframework.batch.core.Step;
|
||||||
|
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||||
|
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
|
||||||
|
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableBatchProcessing
|
||||||
|
public class TransactionJobConfig {
|
||||||
|
private final JobBuilderFactory jobBuilderFactory;
|
||||||
|
private final StepBuilderFactory stepBuilderFactory;
|
||||||
|
|
||||||
|
public TransactionJobConfig(JobBuilderFactory jobBuilderFactory, StepBuilderFactory stepBuilderFactory) {
|
||||||
|
this.jobBuilderFactory = jobBuilderFactory;
|
||||||
|
this.stepBuilderFactory = stepBuilderFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Job transactionJob() {
|
||||||
|
return jobBuilderFactory.get("transactionJob")
|
||||||
|
.start(transactionStep())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Step transactionStep() {
|
||||||
|
return stepBuilderFactory.get("transactionStep")
|
||||||
|
.tasklet((contribution, chunkContext) -> {
|
||||||
|
// 배치 작업 로직
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue