문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
springframework:batch [2018/11/21 17:33] kwon37xi [RunIdIncrementer 사용시 기존 파라미터가 현재 파라미터 지정한 것을 덮어씀] |
springframework:batch [2020/04/16 09:38] kwon37xi |
||
---|---|---|---|
줄 1: | 줄 1: | ||
====== Spring Framework Batch ====== | ====== Spring Framework Batch ====== | ||
* [[springframework: | * [[springframework: | ||
- | * [[http:// | + | |
- | * [[https:// | + | |
- | * [[http:// | + | |
- | * [[https:// | + | |
- | * Spring Batch 2.2 JavaConfig | + | |
- | * [[https:// | + | |
- | * [[https:// | + | |
- | * [[https:// | + | |
- | * [[https:// | + | |
- | * [[https:// | + | |
- | * [[https:// | + | |
- | * Spring Batch Transaction | + | |
- | * [[https:// | + | |
- | * [[https:// | + | |
- | * [[https:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[https:// | + | |
- | * [[https:// | + | |
- | * [[http:// | + | |
- | * [[https:// | + | |
- | * [[https:// | + | |
- | * [[https:// | + | |
- | * [[https:// | + | |
===== @EnableBatchProcessing ===== | ===== @EnableBatchProcessing ===== | ||
* [[https:// | * [[https:// | ||
줄 59: | 줄 29: | ||
* '' | * '' | ||
* SpringBoot 에서 '' | * SpringBoot 에서 '' | ||
+ | |||
===== JobRepository ===== | ===== JobRepository ===== | ||
* '' | * '' | ||
줄 73: | 줄 44: | ||
===== Transaction 설정 ===== | ===== Transaction 설정 ===== | ||
- | ===== 트랜잭션 매니저를 지정하지 않으면 | + | ==== 트랜잭션 매니저를 지정하지 않으면 ==== |
TransactionManager를 지정하지 않으면 다음과 같은 오류가 발생한다. | TransactionManager를 지정하지 않으면 다음과 같은 오류가 발생한다. | ||
줄 106: | 줄 77: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ==== Chunk 사이즈가 크고 Transaction 이 긴데, 외부에 write 대상건을 알려주는 경우 DB Lock 발생할 수 있음 ==== | ||
+ | * batch 에 트랜잭션 매니저를 설정하고, | ||
+ | * 외부에서 그 데이터를 사용할 수 있게 하고자 했다면, | ||
+ | * 절대로 Step 에 트랜잭션 매니저를 지정하지 말고, '' | ||
+ | * 안그러면 CHUNK size 만큼의 처리가 모두 끝날때까지 DB lock 이 잡혀있어서 외부에서 이벤트를 받아서 처리하는 측에서 lock 획득에 실패해서 오류가 발생하게 된다. | ||
===== JobInstanceAlreadyCompleteException: | ===== JobInstanceAlreadyCompleteException: | ||
줄 144: | 줄 121: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ===== Java Config Spring Bean 설정시 리턴 타입을 인터페이스가 아닌 구현 클래스로 지정할 것. ===== | ||
+ | * '' | ||
+ | * 따라서 Spring Batch 용 각 스텝별 Bean 을 생성해서 리턴할 때는 항상 **구현 클래스를 리턴 타입으로 지정**할 것. | ||
+ | * [[https:// | ||
+ | * 다음과 같은 WARN 을 볼 수도 있다. | ||
+ | |||
+ | > o.s.b.c.l.AbstractListenerFactoryBean | ||
+ | |||
+ | |||
+ | ===== Test ===== | ||
+ | * [[https:// | ||
+ | * 이 클래스는 static utility 가 아니라 Bean 으로 생성해줘야 하는 것이다. | ||
+ | * '' | ||
+ | * 특정 Step만 테스트도 가능함. | ||
+ | * [[springframework: | ||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | |||
===== 참고 ===== | ===== 참고 ===== | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | * Spring Batch 2.2 JavaConfig | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * Spring Batch Transaction | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[https:// |