My current Spring Boot application runs a scheduler job with Spring Batch configuration where I have a FlatFileItemReader
for reading the CSV rows, and a simple ItemWriter.
FlatFileItemReader<MyCsvRowDto>
ItemWriter<MyCsvRowDto>
Based on the chunk setup the CSV rows are red 1-by-1, and the writer gets all the data in a list.
I need to extend this logic to be able to read the rows from CSV and additionally a few things from repositories.
ItemReader<MyData>
ItemWriter<MyData>
where MyData contains the rows from CSV and additional things from repositories:
public class MyData {
private MyDatabaseData dbData;
private List<MyCsvRowData> csvData;
}
I am wondering if it is possible to do it still with FlatFileItemReader
somehow, or I need to write a custom ItemReader where I read the data from repositories and then separately the CSV rows with supercsv
?