Class MappingJackson2YamlHttpMessageConverter
- All Implemented Interfaces:
- GenericHttpMessageConverter<Object>,- HttpMessageConverter<Object>
HttpMessageConverter that can read and write the YAML
 data format using 
 the dedicated Jackson 2.x extension.
 By default, this converter supports the MediaType.APPLICATION_YAML_VALUE
 media type. This can be overridden by setting the supportedMediaTypes property.
 
The default constructor uses the default configuration provided by
 Jackson2ObjectMapperBuilder.
- Since:
- 6.2
- Author:
- Hyoungjune Kim
- 
Field SummaryFields inherited from class org.springframework.http.converter.json.AbstractJackson2HttpMessageConverterdefaultObjectMapperFields inherited from class org.springframework.http.converter.AbstractHttpMessageConverterlogger
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct a newMappingJackson2YamlHttpMessageConverterusing the default configuration provided byJackson2ObjectMapperBuilder.MappingJackson2YamlHttpMessageConverter(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Construct a newMappingJackson2YamlHttpMessageConverterwith a customObjectMapper(must be configured with aYAMLFactoryinstance).
- 
Method SummaryModifier and TypeMethodDescriptionvoidsetObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Configure the mainObjectMapperto use for Object conversion.Methods inherited from class org.springframework.http.converter.json.AbstractJackson2HttpMessageConvertercanRead, canRead, canWrite, customizeReader, customizeWriter, getCharset, getContentLength, getDefaultContentType, getJavaType, getJsonEncoding, getMediaTypesForProblemDetail, getObjectMapper, getObjectMappersForType, getSupportedMediaTypes, logWarningIfNecessary, read, readInternal, registerObjectMappersForType, setPrettyPrint, setSupportedMediaTypes, supportsRepeatableWrites, writeInternal, writePrefix, writeSuffixMethods inherited from class org.springframework.http.converter.AbstractGenericHttpMessageConvertercanWrite, supports, write, writeInternalMethods inherited from class org.springframework.http.converter.AbstractHttpMessageConverteraddDefaultHeaders, canRead, canWrite, getDefaultCharset, getSupportedMediaTypes, read, setDefaultCharset, writeMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.http.converter.HttpMessageConvertergetSupportedMediaTypes, read, write
- 
Constructor Details- 
MappingJackson2YamlHttpMessageConverterpublic MappingJackson2YamlHttpMessageConverter()Construct a newMappingJackson2YamlHttpMessageConverterusing the default configuration provided byJackson2ObjectMapperBuilder.
- 
MappingJackson2YamlHttpMessageConverterpublic MappingJackson2YamlHttpMessageConverter(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Construct a newMappingJackson2YamlHttpMessageConverterwith a customObjectMapper(must be configured with aYAMLFactoryinstance).You can use Jackson2ObjectMapperBuilderto build it easily.- See Also:
 
 
- 
- 
Method Details- 
setObjectMapperpublic void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Configure the mainObjectMapperto use for Object conversion. If not set, a defaultObjectMapperinstance is created.Setting a custom-configured ObjectMapperis one way to take further control of the JSON serialization process. For example, an extendedSerializerFactorycan be configured that provides custom serializers for specific types. Another option for refining the serialization process is to use Jackson's provided annotations on the types to be serialized, in which case a custom-configured ObjectMapper is unnecessary.The ObjectMappermust be configured with aYAMLFactoryinstance.
 
-