goodbye

1. 스프링 배치 활성화 본문

Spring/Spring Batch

1. 스프링 배치 활성화

goodbye 2022. 7. 23. 23:23

build.gradle

implementation 'org.springframework.boot:spring-boot-starter-batch'

 

@EnableBatchProcessing

  • 스프링 배치가 작동하기 위해 선언해야 하는 어노테이션
  • 총 4개의 설정 클래스를 실행시키며 스트링 배치의 모든 초기화 및 실행 구성이 이루어진다

 

 

 BatchAutoConfiguration 

  • 스트링 배치가 초기화 될때 자동으로 실행되는 설정 클래스
  • Job을 수행하는 Job LauncherApplicationRunner Bean을 생성

 

SimpleBatchConfiguration

  • JobBuilderFactiory, SetpBuilderFactory 생성
  • 스프링 배치의 주요 구성 요소 생성 - 프록시 객체 생성

 

BatchConfigurerConfiguration

   BasicBatchConfigurer

  • SimpleBatchConfiguration에서 생성한 프록시 객체의 실제 대상 객체를 생성하는 생성 클래스
  • Bean으로 의존성 주입 받아서 주요 객체들을 참조해서 사용할 수 있음

   JpaBatchCOnfigurer

  • JPA 관련 객체를 생성하는 설정 클래스
  • 사용자 정의 BatchConfigurer 인터페이스를 구현하여 사용 할 수 있음
  • 스프링 부트 배치의 자동 설정 클래스가 실행
  •  ->  Bean으로 등록된 모든 JOB 검색 ->  초기화 - > JOB 수행

 

@EnableBatchProcessing 어노테이션 클래스 호출 흐름

  • SimpleBatchConfiguration
  •   -> BatchConfigurerConfiguration
  •    -> BatchAutoConfiguration

'Spring > Spring Batch' 카테고리의 다른 글

2. 스프링 배치 테이블  (0) 2022.07.30
Comments