2013-12-18 2 views
0

footercallback을 정의했지만 바닥 글 정보가 파일에 기록되지 않습니다. 여기에 설정과 코드가 있습니다. 내가 놓친 게 있니? afterstep이 호출되고 WriteCount가 로그에는 기록되지만 파일에는 기록되지 않습니다. 작업 데프을 : tplBatchFooterCallback 올바르게 FlatFileItemWriter바닥 글 콜백이 호출되지 않음

<job id="sodfeed" job-repository="tplJobRepository" xmlns="http://www.springframework.org/schema/batch"> 

    <step id="readWriteBalances"> 
     <tasklet> 
     <chunk reader="balancesReader" writer="balancesWriter" commit-interval="100" > 

     </chunk>  
      <listeners> 
       <listener ref="tplBatchFooterCallback" /> 
       <listener ref="tplBatchFailureListener" /> 
      </listeners> 


     </tasklet> 
    </step> 
</job> 

public class FooterCallback extends StepExecutionListenerSupport implements FlatFileFooterCallback{ 

private StepExecution stepExecution; 
public void writeFooter(Writer writer) throws IOException { 
    writer.write("EOF" + stepExecution.getWriteCount()); 
    System.out.println("**************************EOF" + stepExecution.getWriteCount()); 
} 
    public ExitStatus afterStep(StepExecution stepExecution) { 
    ExitStatus returnStatus = stepExecution.getExitStatus(); 
    logger.info("Number of records written:"+stepExecution.getWriteCount()); 

    return returnStatus; 
} 
} 

답변

0

을 주입? 리스너와 콜백은 다른 방식으로 사용됩니다.

조회 official javadoc.

관련 문제