use of org.springframework.batch.item.file.transform.DelimitedLineAggregator in project nixmash-blog by mintster.
the class DemoJobConfiguration method demoJobWriter.
@Bean
public ItemWriter<PostDTO> demoJobWriter() {
FlatFileItemWriter<PostDTO> writer = new FlatFileItemWriter<>();
writer.setResource(new FileSystemResource("/home/daveburke/web/nixmashspring/posts.csv"));
DelimitedLineAggregator<PostDTO> delLineAgg = new DelimitedLineAggregator<>();
delLineAgg.setDelimiter(";");
BeanWrapperFieldExtractor<PostDTO> fieldExtractor = new BeanWrapperFieldExtractor<>();
fieldExtractor.setNames(new String[] { "postTitle" });
delLineAgg.setFieldExtractor(fieldExtractor);
writer.setLineAggregator(delLineAgg);
return writer;
}
Aggregations