Skip to content
Advertisement

how to configure FlatFileItemWriter to output the file to a ByteArrayRecource?

I have a situation in which the deployment server doesn’t allow the application to output files to its file system … so what i’m trying to do is to configure the FlatFileItemWriter to output the result file to a static Resource property (multi Threading is not an issue here ) . the current code i have is

JavaScript

is there any way i can output this file to a static Resource property to be accessed later, for example ByteArrayResource or InMemoryResource . thanks in advance

Advertisement

Answer

The FlatFileItemWriter is designed to write items to a flat file or a writable Resource that represents a file. Here is an excerpt from its Javadoc:

JavaScript

So in your case, you need to use a custom writer that writes items to an in-memory resource.

Advertisement