inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

devji님의 게시글

devji devji

@devsajaya237843

수강평 작성수
-
평균평점
-

게시글 1

질문&답변

spring batch 5

자체 해결 우선 해당 질문에 대한 부분 코드는 해결되어서 참고하시라고 공유 드립니다. @Configuration public class HelloJobConfiguration { @Bean public Job helloJob(JobRepository jobRepository, Step helloStep1, Step helloStep2) { return new JobBuilder("helloJob", jobRepository) .start(helloStep1) .next(helloStep2) .build(); } @Bean public Step helloStep1(JobRepository jobRepository, PlatformTransactionManager tx) { return new StepBuilder( "helloStep1", jobRepository) .tasklet((contribution, chunkContext) -> { System.out.println("===================================="); System.out.println(" helloStep1 executed "); System.out.println("===================================="); return RepeatStatus.FINISHED; }, tx).build(); } @Bean public Step helloStep2(JobRepository jobRepository, PlatformTransactionManager tx) { return new StepBuilder( "helloStep2", jobRepository) .tasklet((contribution, chunkContext) -> { System.out.println("===================================="); System.out.println(" helloStep2 executed "); System.out.println("===================================="); return RepeatStatus.FINISHED; }, tx).build(); } } 참고로 SpringBatchApplication에서 @EnableBathProcessing 어노테이션 지워야 로그 출력 됩니다. @SpringBootApplication public class SpringBatchApplication { public static void main(String[] args) { SpringApplication.run(SpringBatchApplication.class, args); } }

좋아요수
2
댓글수
2
조회수
1979