I want java config of below :
`
<step id="step1">
<tasklet>
<chunk reader="itemReader" writer="itemWriter" commit-interval="2"/>
<no-rollback-exception-classes>
<include class="org.springframework.batch.item.validator.ValidationException"/>
</no-rollback-exception-classes>
</tasklet>
</step>
`
<no-rollback-exception-classes>
in particular.
Thanks!!!
The equivalent to no-rollback-exception-classes
in Java config is the org.springframework.batch.core.step.builder.FaultTolerantStepBuilder#noRollback method.
In your case, it would be something like:
@Bean
public Step step(StepBuilderFactory stepBuilderFactory, ItemReader<Integer> itemReader, ItemWriter<Integer> itemWriter) {
return stepBuilderFactory.get("step1")
.<Integer, Integer>chunk(2) // TODO change Integer with your item type
.reader(itemReader)
.writer(itemWriter)
.faultTolerant()
.noRollback(org.springframework.batch.item.validator.ValidationException.class)
.build();
}
Hope this helps.