I am new to Spring batch application. I am trying to use FlatFileItemWriter
to write data to a file. The task - this application creates a file at a given path, but now writes the actual content to it.
The following are details related to the code:
List<String> dataFileList :
This list contains the data that I want to write to the file.
FlatFileItemWriter<String> writer = new FlatFileItemWriter<>();
writer.setResource(new FileSystemResource("C:\\Desktop\\test"));
writer.open(new ExecutionContext());
writer.setLineAggregator(new PassThroughLineAggregator<>());
writer.setAppendAllowed(true);
writer.write(dataFileList);
writer.close();
It just generates the file in the right place, but the content is not written to the file.
Am I missing something? Help is much appreciated.
Thank!
source
share