사용자 도구

사이트 도구


springframework:springboot:batch

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
springframework:springboot:batch [2018/08/07 16:44]
kwon37xi [application.properties/yml]
springframework:springboot:batch [2018/11/21 17:28]
kwon37xi
줄 7: 줄 7:
  
   * [[https://github.com/kwon37xi/springboot2-batch-example|SpringBoot2 Batch Example]] 예제 소스   * [[https://github.com/kwon37xi/springboot2-batch-example|SpringBoot2 Batch Example]] 예제 소스
 +
 ===== 의존성 및 bootJar 설정 ===== ===== 의존성 및 bootJar 설정 =====
 <code groovy> <code groovy>
줄 64: 줄 65:
 </code> </code>
  
 +> ''DefaultBatchConfigurer'' 사용시에 이 클래스내에서 ''transactionManager''를 batchDataSource 용으로 생성해버려서 원래 애플리케> 이션의
 +> DataSourceTransactionManagerAutoConfiguration.DataSourceTransactionManagerConfiguration 가 작동하지 않게 된다.
 +> 따라서 항상 **애플리케이션용 DataSource에 대한 transactionManager를 항상 명시적으로 만들어주고 @Primary 설정**을 해줘야 한다.
  
 ===== 예제 Batch Job Configuration ===== ===== 예제 Batch Job Configuration =====
줄 118: 줄 122:
     job:     job:
       enabled: true       enabled: true
 +    initialize-schema: embedded
   main:   main:
     web-application-type: NONE     web-application-type: NONE
 </code> </code>
 +  * ''spring.batch.initialize-schema'' 는 거의 항상 ''embdded''로 지정하며, 별도 DB 사용시에는 ''never''로 지정한다. ''always''인 경우는 거의 없다고 봄.
   * SpringBoot 2.x 기준, ''spring-boot-starter-web'', ''spring-boot-starter-webflux''가 의존성에 없어야 하며, 만약 있다면 ''spring.main.web-application-type=NONE''으로 설정할 것.   * SpringBoot 2.x 기준, ''spring-boot-starter-web'', ''spring-boot-starter-webflux''가 의존성에 없어야 하며, 만약 있다면 ''spring.main.web-application-type=NONE''으로 설정할 것.
 +
 ===== 실행 ===== ===== 실행 =====
 ''bootJar''로 jar를 생성하고 ''bootJar''로 jar를 생성하고
줄 134: 줄 141:
  
 **''spring.batch.job.names''는 쉼표로 구분하여 여러개도 지정 가능하다.** **''spring.batch.job.names''는 쉼표로 구분하여 여러개도 지정 가능하다.**
 +
 +===== 참고 =====
 +  * [[https://cheese10yun.github.io/spring-batch-basic/|Spring Batch 간단 정리 - Yun Blog | 기술 블로그]]
 +
 +
springframework/springboot/batch.txt · 마지막으로 수정됨: 2021/09/06 16:06 저자 kwon37xi