<aside> 💡 Spring Batch 5는 최소 버전으로 Java 17이 필요한 Spring Framework 6을 기반 https://github.com/spring-projects/spring-batch/wiki/Spring-Batch-5.0-Migration-Guide#dependencies-upgrade
</aside>
implementation 'org.springframework.boot:spring-boot-starter-batch'
추가
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-batch'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation'org.springframework.boot:spring-boot-starter-quartz'
implementation 'org.postgresql:postgresql:42.7.2'
runtimeOnly 'org.postgresql:postgresql'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation platform('org.junit:junit-bom:5.9.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
}
spring:
main:
allow-bean-definition-overriding: true
batch:
job:
enabled: true # 서버 재시작시 배치 자동실행 방지 = false
jdbc:
initialize-schema: always
quartz:
job-store-type: jdbc
jdbc:
initialize-schema: always
# DB ...
//@EnableBatchProcessing // 배치 기능 활성 spring 3.0 이상은 사용하지 않는다 기본 설정이 백오프 된다.
@EnableScheduling //Spring scheduler
@SpringBootApplication
public class BatchTestApplication {
public static void main(String[] args) {
SpringApplication.run(BatchTestApplication.class, args);
}
}
JobBuilderFactory
→ JobBuilder
형식으로 변경