Spring批处理在写入后调用异常

时间:2019-03-26 16:21:30

标签: spring-batch

我想在写入csv文件后调用一个异常(强制停止作业),但是它不起作用。

public class WriterListener implements ItemWriteListener {

    @Override
    public void beforeWrite(List<Object> items) throws Exception {
        // TODO Auto-generated method stub

    }

    @Override
    public void afterWrite(List<Object> items)  {
        throw new RuntimeException("Failing job : Fin de la step1");

    }

    @Override
    public void onWriteError(List<Object> items, Exception ex) throws Exception {
        // TODO Auto-generated method stub

    }
}

0 个答案:

没有答案