Skip to content

Instantly share code, notes, and snippets.

@mystelynx
Created April 4, 2013 10:39
Show Gist options
  • Save mystelynx/5309411 to your computer and use it in GitHub Desktop.
Save mystelynx/5309411 to your computer and use it in GitHub Desktop.
SimpleStepFactoryBeanはエラーハンドラの指定ができなかったので、FaultTolerantStepFactoryBeanに乗り換えた
<bean id="faultTolerantStep"
class="org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean"
abstract="true">
<property name="transactionManager" ref="transactionManager" />
<property name="jobRepository" ref="jobRepository" />
<property name="startLimit" value="100" />
<property name="commitInterval" value="1" />
<property name="skipLimit" value="2" />
<!-- リトライポリシーの設定 -->
<property name="retryPolicy">
<bean class="org.springframework.batch.retry.policy.ExceptionClassifierRetryPolicy">
<property name="policyMap">
<map>
<entry>
<key>
<value type="java.lang.Class">java.lang.NumberFormatException</value>
</key>
<bean class="org.springframework.batch.retry.policy.NeverRetryPolicy" />
</entry>
</map>
</property>
</bean>
</property>
<!-- スキップポリシーの設定 -->
<property name="skipPolicy">
<bean class="org.springframework.batch.core.step.skip.ExceptionClassifierSkipPolicy">
<property name="policyMap">
<map>
<entry>
<key>
<value type="java.lang.Class">java.lang.NumberFormatException</value>
</key>
<bean class="org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy" >
<property name="skipLimit" value="2" />
</bean>
</entry>
</map>
</property>
</bean>
</property>
</bean>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment