首页 文章

具有FooterCallback和Header回调的Spring Batch自定义Writer

提问于
浏览
0

我试图通过在我的自定义编写器调用中实现标头回调和footercallback在自定义编写器中添加页眉和页脚 .

写方法成功 . 但是不会调用write header和writefooter .

public class CustomOAFileItemWriter extends StepExecutionListenerSupport implements  ItemWriter<OAExtract>,FlatFileHeaderCallback,FlatFileFooterCallback{


public void write(List<? extends OAExtract> oaExtractList) throws Exception {
        FileOutputStream fs = new FileOutputStream("C:\\archivedFiles\\out.bin");

}

public void writeHeader(Writer writer) throws IOException {

        System.out.println("Writing Header record");

}

public void writeFooter(Writer writer) throws IOException {

        System.out.println("Writing Footerrecord");
}

拥有Spring批次经验的人可以帮助我吗?

谢谢,赖

2 回答

相关问题