Reading line breaks in CSV which are quoted in the file in FlatfileItemReader of spring batch
out of the box the FlatFileItemReader uses a SimpleRecordSeparatorPolicy, for your usecase
- commented part goes over 2 or more lines
you need to set the DefaultRecordSeparatorPolicy
Cited from its javadoc:
A RecordSeparatorPolicy that treats all lines as record endings, as long as they do not have unterminated quotes, and do not end in a continuation marker.
example xml configuration
<bean id="reader"
class="org.springframework.batch.item.file.FlatFileItemReader">
...
<property name="recordSeparatorPolicy">
<bean class="org.springframework.batch.item.file.separator.DefaultRecordSeparatorPolicy" />
</property>
...
</bean>