Spring batch itemwriter interface

123 views Asked by At

The write method of Itemwriter has been changed in the spring version 5.

@Override
public void write(List<? extends List<DataDTO>> items) throws Exception{
    for(List<DataDTO> sublist:items){
        writer.write(sublist);
}

The above writer is FlatFileItemWriter.

I changed to the following

@Override
public void write(Chunk<? extends List<DataDTO>> items) throws Exception{
    for(List<DataDTO> sublist:items){
        writer.write((Chunk<? extends DataDTO>)sublist);
    }
}

Is this correct way of replacing/fix? need some help.

Im expecting the correct fix.

0

There are 0 answers