I am trying to use the lineSeparator property from the FlatFileItemWriter class.
I need to have a return line after each row regardless of the execution platform. I am using Spring Batch 2.0.1 I tried \r\n then \r then \n but when i open the file it has the values in the file.
Example:
01 013 013 105 013 1 \n01
here is my code:
Code:<beans:bean id="courseWriter" class="org.springframework.batch.item.file.FlatFileItemWriter"> <beans:property name="resource" value="file:/tmp/course.txt" /> <beans:property name="lineSeparator" value="\r\n" /> <beans:property name="shouldDeleteIfExists" value="true" /> <beans:property name="lineAggregator"> <beans:bean class="org.springframework.batch.item.file.transform.FormatterLineAggregator"> <beans:property name="fieldExtractor"> <beans:bean class="edu.rutgers.enterprise.fyss.batch.MapFieldExtractor"> <beans:property name="names" value="faculty,dept,name,subject,active,descript"/> </beans:bean> </beans:property> <beans:property name="format" value="%-30s%-30s%-30s%-30s%-1s%-35s"/> </beans:bean> </beans:property> </beans:bean>


Reply With Quote