Class JsonFileItemWriter<T>

Type Parameters:
T - type of object to write as json representation
All Implemented Interfaces:
ResourceAwareItemWriterItemStream<T>, ItemStream, ItemStreamWriter<T>, ItemWriter<T>, org.springframework.beans.factory.InitializingBean

public class JsonFileItemWriter<T> extends AbstractFileItemWriter<T>
Item writer that writes data in json format to an output file. The location of the output file is defined by a WritableResource and must represent a writable file. Items are transformed to json format using a JsonObjectMarshaller. Items will be enclosed in a json array as follows:

[ {json object}, {json object}, {json object} ]

The implementation is not thread-safe.
Since:
4.1
Author:
Mahmoud Ben Hassine, Yanming Zhou
See Also:
  • Constructor Details

    • JsonFileItemWriter

      public JsonFileItemWriter(org.springframework.core.io.WritableResource resource, JsonObjectMarshaller<T> jsonObjectMarshaller)
      Create a new JsonFileItemWriter instance.
      Parameters:
      resource - to write json data to
      jsonObjectMarshaller - used to marshal object into json representation
  • Method Details