Our processor returns a List> (effectively passing a List) to our >
ItemWriter.
Now, we observed t
public class ListUnpackingItemWriter implements FlatFileItemWriter>, ItemStream, InitializingBean {
@Override
public void afterPropertiesSet() {
setLineAggregator(item -> String.join("\n", item.stream().map(T::toString).collect(Collectors.toList())));
}
}
Just added a custom line aggregator to the above solution, this helps in writing the content to a file by using FlatFileItemWriter. You can replace >
T with actual class name to avoid compilation error while calling toString() method.