Jyo*_*Jyo 4 java spring spring-batch spring-batch-tasklet
以前,我们使用Spring Batch 3.0.6并尝试将其更新为4.1.1。我的工作只有一个ItemReader和一个ItemProcessor- 没有ItermWriter提供。更新前运行正常。
现在,我得到:
java.lang.IllegalStateException: ItemWriter must be provided.
与之前的版本相比有何变化?
<job id="myJob" parent="baseJob">
<step id="myStep" parent="baseStep">
<tasklet>
<chunk reader="myItemReader" processor="myProcessor"
commit-interval="1" skip-limit="100000" retry-limit="1">
<skippable-exception-classes>
<include class="ExceptionClass"/>
</skippable-exception-classes>
<retryable-exception-classes>
<include class="ExceptionClass"/>
</retryable-exception-classes>
</chunk>
</tasklet>
<listeners merge="true">
<listener ref="promotionListener"/>
<listener ref="skippableExceptionListener"/>
</listeners>
</step>
</job>
Run Code Online (Sandbox Code Playgroud)
ItemWriter成为强制性的BATCH-2624。根据问题链接中的信息,此更改在版本后生效3.0.10,4.0.2并且4.1.0
如果你真的不需要ItemWriter,你可以实现一个虚拟的:
public class NoOpItemWriter implements ItemWriter<Object>{
@Override
public void write(List<? extends Object> items) throws Exception {
}
}
Run Code Online (Sandbox Code Playgroud)
并配置使用它:
<bean id="noOpItemWriter" class="org.foo.bar.NoOpItemWriter"/>
<chunk reader="myItemReader" processor="myProcessor" writer="noOpItemWriter">
.....
</chunk>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2206 次 |
| 最近记录: |