I am currently writing a Spring batch where I am reading a chunk of data, processing it and then I wish to pass this data to 2 writers. One writer would simply update the da
You don't necessarily have to use xml like the example. If the rest of your code uses annotation, you could simply do the following.
public ItemWriter writerOne(){
ItemWriter writer = new ItemWriter();
//your logic here
return writer;
}
public ItemWriter writerTwo(){
ItemWriter writer = new ItemWriter();
//your logic here
return writer;
}
public CompositeItemWriter compositeItemWriter(){
CompositeItemWriter writer = new CompositeItemWriter();
writer.setDelegates(Arrays.asList(writerOne(),writerTwo()));
return writer;
}