I have a Spring Batch app that uses ItemProcessor to process items.
@Component
@StepScope
public class MemberProcessor<T> implements ItemProcessor<T, Member> {
@Override
public Member process(T t) throws Exception {
return processMember((UnprocessedMember) t);
}
}
@Component
@StepScope
public class MemberWriter implements ItemWriter<Member> {
@Override
public void write(List<? extends Member> members) throws Exception {
//store the members in db
saveToDb(members);
}
}
I want to know if it is possible to update an item after it's been processed so that when it gets to ItemWriter, it's updated. For example, I process one item, and then I process another one that may need to edit a property of the previous item. As the previous item has not reached the Writer, I can't do the update on the database and the first item gets written without the update