Spring Batch - Is it possible to have a dynamic column in FlatFileReader?

后端 未结 2 1267
忘了有多久
忘了有多久 2021-01-19 23:23

I\'m dealing with many CSVs files that don\'t have a fixed header/column, saying that I can get file1.csv with 10 column and file2.csv with 50 column.

I can\'t know

2条回答
  •  心在旅途
    2021-01-20 00:28

    Create your own LineTokenizer implementation. The DelimitedLineTokenizer expects a predefined number of columns. If you create your own, you can be as dynamic as you want. You can read more about the LineTokenizer in the documentation here: http://docs.spring.io/spring-batch/apidocs/org/springframework/batch/item/file/transform/LineTokenizer.html

提交回复
热议问题