강의

멘토링

커뮤니티

Inflearn Community Q&A

whgustn7300018's profile image
whgustn7300018

asked

[Spring Batch Introduction] Learning the core of Spring Batch through examples

Branch processing according to multiple step operation and execution status

reader, writer, processor에서 적용

Written on

·

459

0

tasklet이 아닌 chunk 단위에서 step 간에 데이터 공유를 하고 싶다면 어떤 식으로 코드를 짜야 할까요 ?

찾아보니 방법이 달라서 적용이 힘든데 궁금합니다..

spring-batch

Answer 1

0

mjcoding님의 프로필 이미지
mjcoding
Instructor

안녕하세요 :)

아래의 코드[0] 처럼 chunkContext에서 저장하고 꺼내올 수 있습니다.

ExecutionContext executionContext = chunkContext
   .getStepContext()
   .getStepExecution()
   .getJobExecution()
   .getExecutionContext();
executionContext.put("someKey", "hello!!");

혹시 위의 방법으로 해결이 안될까요?

[0] https://github.com/junngo/spring-batch-tutorial/blob/master/src/main/java/com/example/SpringBatchTutorial/job/MultipleStep/MultipleStepJobConfig.java#L57

whgustn7300018's profile image
whgustn7300018

asked

Ask a question