Spring Batch事务处理
事务模型描述 1、step之间事务独立 2、step划分成多个chunk执行,chunk事务彼此独立,互不影响;chunk开始开启一个事务,正常结束提交 图-job总体事务 图-step内部事务 事务提交&回滚 1、事务提交条件:chunk执行正常,未抛RuntimeExecption 2、默认情况下,Reader、Processor、Writer抛出未捕获RuntimeException,当前chunk事务回滚,step失败,job失败 3、通过以下配置,保证出现异常时,事务不回滚,事务继续提交: < batch : tasklet > < batch : no - rollback - exception - classes > </ batch : no - rollback - exception - classes > </ batch : tasklet > 4、事务配置.通过以下配置,改变事务行为 < batch : tasklet > </ batch : tasklet > 默认配置: DEFAULT+REQUIRED 参数配置影响 1、任务恢复 </ batch : job > 2、跳过 < batch : chunk skip - limit = "20" > < batch : skippable - exception - classes > </