I am trying to parse a CSV file with FlatFileItemReader. This CSV contains some quoted newline characters as shown below.
email, name
[email protected], "NEW NAME
ABC"
But this parsing is failing with required fields are 2 but actual is 1.
What I am missing in my FlatFileReader configuration?
<property name="lineMapper">
<bean class="org.springframework.batch.item.file.mapping.DefaultLineMapper">
<!-- The lineTokenizer divides individual lines up into units of work -->
<property name="lineTokenizer">
<bean
class="org.springframework.batch.item.file.transform.DelimitedLineTokenizer">
<!-- Names of the CSV columns -->
<property name="names"
value="email,name" />
</bean>
</property>
<!-- The fieldSetMapper maps a line in the file to a Product object -->
<property name="fieldSetMapper">
<bean
class="com.abc.testme.batchjobs.util.CustomerFieldSetMapper" />
</property>
</bean>
</property>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…