-
Notifications
You must be signed in to change notification settings - Fork 0
Spring Boot Batch
stella edited this page Jun 18, 2014
·
6 revisions
- Boot 에서 내부적으로 JobLauncherCommandLineRunner를 생성, 지정한 JOB들을 실행시킨다.
- Job 구동 환경에 대해 간단하게 설정 가능
@Configuration
@ComponentScan
@EnableBatchProcessing
@EnableAutoConfiguration
public class MelonApplication {
public static void main( String [] args ) {
SpringApplication app = new SpringApplication(MelonApplication . class);
app .run(args );
}
}- 위 main을 실행시킬때 파라메터로 실행시킬 JOB을 지정한다. 콤마(,)로 여러개의 JOB 지정 가능. 그냥 실행할 경우 JobRepository에 등록된 모든 job이 실행되니 주의..!!
--spring.batch.job.names=myjob
- 실행결과 로그 --> 샘플이라서 job이 없어서 수행하지 않는다.
[INFO ] 2014-06-18 11:49:25 JobLauncherCommandLineRunner - Running default command line with: [--spring.batch.job.names=myjob]
[DEBUG] 2014-06-18 11:49:25 JobLauncherCommandLineRunner - No job found in registry for job name: myjob
- Boot와 Batch로 같이 구성할 경우 이런식으로 실행시키는게 맞는지 아직 레퍼런스가 부족...