As I said in the comment of the answer your linked, you can use a FlatFileItemReader
instead of the ListItemReader
and it should work. I used the ListItemReader
in order to provide a self-contained example you can run (without the need to upload a csv file, etc). The point of the other question was about how to trim the leading/trailing "
before parsing the lines, and the trick was to use a composite item processor as shown in the example.
You don’t need to create a new reader, here is an example of a FlatFileItemReader
you can use with the same example:
@Bean
public FlatFileItemReader<String> itemReader() {
return new FlatFileItemReaderBuilder<String>()
.name("itemReader")
.resource(new FileSystemResource("/absolute/path/to/file"))
.lineMapper(new PassThroughLineMapper())
.build();
}
Hope this helps.
0
solved Spring Batch : How to parse a horked CSV file?