Class JacksonJsonEncoder
java.lang.Object
org.springframework.http.codec.JacksonCodecSupport
org.springframework.http.codec.AbstractJacksonEncoder
org.springframework.http.codec.json.JacksonJsonEncoder
- All Implemented Interfaces:
- Encoder<Object>,- HttpMessageEncoder<Object>
Encode from an 
Object stream to a byte stream of JSON objects using
 Jackson 3.x. For non-streaming
 use cases, Flux elements are collected into a List before
 serialization for performance reason.
 The default constructor loads JacksonModules
 found by MapperBuilder.findModules(ClassLoader).
- Since:
- 7.0
- Author:
- Sebastien Deleuze
- See Also:
- 
Field SummaryFields inherited from class org.springframework.http.codec.JacksonCodecSupportFILTER_PROVIDER_HINT, JSON_VIEW_HINT, logger, objectMapperRegistrations
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct a new instance with aJsonMappercustomized with theJacksonModules found byMapperBuilder.findModules(ClassLoader)andProblemDetailJacksonMixin.JacksonJsonEncoder(ObjectMapper mapper) Construct a new instance with the providedObjectMapper.JacksonJsonEncoder(ObjectMapper mapper, MimeType... mimeTypes) Construct a new instance with the providedObjectMapperandMimeTypes.
- 
Method SummaryModifier and TypeMethodDescriptionprotected ObjectWritercustomizeWriter(ObjectWriter writer, @Nullable MimeType mimeType, ResolvableType elementType, @Nullable Map<String, Object> hints) Subclasses can use this method to customize theObjectWriterused for writing values.Return the supported media type(s) forProblemDetail.Methods inherited from class org.springframework.http.codec.AbstractJacksonEncodercanEncode, encode, encodeValue, getAnnotation, getEncodableMimeTypes, getEncodableMimeTypes, getEncodeHints, getJsonEncoding, getStreamingMediaTypes, getStreamingMediaTypeSeparator, setStreamingMediaTypesMethods inherited from class org.springframework.http.codec.JacksonCodecSupportgetHints, getJavaType, getMimeTypes, getMimeTypes, getObjectMapper, getObjectMapperRegistrations, getObjectMappersForType, getParameter, registerObjectMappersForType, selectObjectMapper, supportsMimeType
- 
Constructor Details- 
JacksonJsonEncoderpublic JacksonJsonEncoder()Construct a new instance with aJsonMappercustomized with theJacksonModules found byMapperBuilder.findModules(ClassLoader)andProblemDetailJacksonMixin.
- 
JacksonJsonEncoderConstruct a new instance with the providedObjectMapper.- See Also:
 
- 
JacksonJsonEncoderConstruct a new instance with the providedObjectMapperandMimeTypes.- See Also:
 
 
- 
- 
Method Details- 
getMediaTypesForProblemDetailDescription copied from class:JacksonCodecSupportReturn the supported media type(s) forProblemDetail. By default, an empty list, unless overridden in subclasses.- Overrides:
- getMediaTypesForProblemDetailin class- JacksonCodecSupport
 
- 
customizeWriterprotected ObjectWriter customizeWriter(ObjectWriter writer, @Nullable MimeType mimeType, ResolvableType elementType, @Nullable Map<String, Object> hints) Description copied from class:AbstractJacksonEncoderSubclasses can use this method to customize theObjectWriterused for writing values.- Overrides:
- customizeWriterin class- AbstractJacksonEncoder
- Parameters:
- writer- the writer instance to customize
- mimeType- the selected MIME type
- elementType- the type of element values to write
- hints- a map with serialization hints; the Reactor Context, when available, may be accessed under the key- ContextView.class.getName()
- Returns:
- the customized ObjectWriterto use
 
 
-