Exceptions are not reaching the onWriteError
method of my ItemWriteListener
:
public class KeywordsListener implements ItemWriteListener<ClipKeywords> {
@Override
public void onWriteError(Exception exception, List<? extends ClipKeywords> items) {
for (ClipKeywords item : items) {
log.info(item.getPhoneNum() + item.getKeyword());
}
}
}
@Bean
public KeywordsListener keywordsListener() {
return new KeywordsListener();
}
@Bean
public Step step1() {
return stepBuilderFactory.get("step1").<ClipKeywords, ClipKeywords> chunk(1).reader(reader(null))
.processor(processor()).writer(writer()).faultTolerant().listener(keywordsListener()).build();
}
build.gradle
compile(group: 'org.springframework.boot', name: 'spring-boot-starter', version:'1.5.2.RELEASE') {
exclude(module: 'commons-logging')
}
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version:'1.47'
compile group: 'com.googlecode.json-simple', name: 'json-simple', version:'1.1.1'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-batch', version:'1.5.2.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-aop', version:'1.5.2.RELEASE'
compile group:'org.springframework.boot', name:'spring-boot-starter-data-mongodb'
Can someone please help me?