Spring Batch - FlatFileItemReader for different delimited files
问题 I have two different files, one delimited by pipe separator "|" and one by comma ",". I am using Spring Batch to process these files using FlatFileItemReader. I dont want to have two readers and two writers for the files. Can I have somehow one generic FlatFileItemReader for both files? Also the objects to which the files will be mapped are different. 回答1: You can inject a DelimitedLineTokenizer and you can set the delimiter as per requirement. you can make it generic using