Spring Batch 2.2.7中缺少SkipLimitStepFactoryBean

时间:2016-05-27 14:11:00

标签: java spring spring-batch

我正在从Spring Batch 1.1.4迁移到Spring Batch 2.2.7,我看到新库中缺少SkipLimitStepFactoryBean

我收到了此链接 - http://forum.spring.io/forum/spring-projects/batch/58139-skiplimitstepfactorybean-missing-in-spring-batch-2-0-0-m3,表示已将其重命名为FaultTolerantStepFactoryBean

但是,当我看到此类FaultTolerantStepFactoryBean时,它没有我要配置的setFatalExceptionClasses(java.lang.Class[])方法。有谁知道怎么做?

以下是Spring Batch 1.1.4 jobs.xml

中配置bean的方法
<bean id="loadbaseListSkipLimitStep"
        class="org.springframework.batch.core.step.item.SkipLimitStepFactoryBean"
        parent="loadbaseListStep" 
        abstract="true">
    <property name="skipLimit" value="0" />
    <property name="retryPolicy" ref="recoverableExceptionRetryPolicy" />
    <property name="backOffPolicy" ref="timedBackoffPolicy" />
    <property name="fatalExceptionClasses" value="org.springframework.jms.JmsException, org.springframework.dao.DataAccessException" />
</bean>

1 个答案:

答案 0 :(得分:0)

正如M. Deinum所述,

  

因为一切都是致命的,除非你将它指定为可跳过的   异常。

因此,我的XML配置更改如下。

<bean id="loadbaseListSkipLimitStep"
        class="org.springframework.batch.core.step.item.SkipLimitStepFactoryBean"
        parent="loadbaseListStep" 
        abstract="true">
    <property name="skipLimit" value="0" />
    <property name="retryPolicy" ref="recoverableExceptionRetryPolicy" />
    <property name="backOffPolicy" ref="timedBackoffPolicy" />
</bean>