Class JacksonJsonMessageConverter
java.lang.Object
org.springframework.amqp.support.converter.AbstractMessageConverter
org.springframework.amqp.support.converter.AbstractJacksonMessageConverter
org.springframework.amqp.support.converter.JacksonJsonMessageConverter
- All Implemented Interfaces:
MessageConverter,SmartMessageConverter,Aware,BeanClassLoaderAware
JSON converter that uses the Jackson 3.
- Since:
- 4.0
- Author:
- Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.amqp.support.converter.AbstractJacksonMessageConverter
DEFAULT_CHARSET, log, objectMapper -
Constructor Summary
ConstructorsConstructorDescriptionConstruct with an internalJsonMapperinstance and trusted packed to all (*).JacksonJsonMessageConverter(String... trustedPackages) Construct with an internalJsonMapperinstance.JacksonJsonMessageConverter(tools.jackson.databind.json.JsonMapper jsonMapper) Construct with the providedJsonMapperinstance and trusted packed to all (*).JacksonJsonMessageConverter(tools.jackson.databind.json.JsonMapper jsonMapper, String... trustedPackages) Construct with the providedJsonMapperinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectconvertContent(Message message, @Nullable Object conversionHint, MessageProperties properties, @Nullable String encoding) protected booleanvoidsetUseProjectionForInterfaces(boolean useProjectionForInterfaces) Set to true to use Spring Data projection to create the object if the inferred parameter type is an interface.Methods inherited from class org.springframework.amqp.support.converter.AbstractJacksonMessageConverter
createMessage, createMessage, doFromMessage, fromMessage, fromMessage, getClassLoader, getClassMapper, getDefaultCharset, getJavaTypeMapper, getSupportedContentType, getTypePrecedence, isTypeMapperSet, setAlwaysConvertToInferredType, setAssumeSupportedContentType, setBeanClassLoader, setClassMapper, setDefaultCharset, setJavaTypeMapper, setNullAsOptionalEmpty, setSupportedContentType, setTypePrecedenceMethods inherited from class org.springframework.amqp.support.converter.AbstractMessageConverter
isCreateMessageIds, setCreateMessageIds, toMessage, toMessageMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.amqp.support.converter.MessageConverter
toMessage, toMessage
-
Constructor Details
-
JacksonJsonMessageConverter
public JacksonJsonMessageConverter()Construct with an internalJsonMapperinstance and trusted packed to all (*). -
JacksonJsonMessageConverter
Construct with an internalJsonMapperinstance. TheDeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIESandMapperFeature.DEFAULT_VIEW_INCLUSIONare set to false on theJsonMapper.- Parameters:
trustedPackages- the trusted Java packages for deserialization- See Also:
-
JacksonJsonMessageConverter
public JacksonJsonMessageConverter(tools.jackson.databind.json.JsonMapper jsonMapper) Construct with the providedJsonMapperinstance and trusted packed to all (*).- Parameters:
jsonMapper- theJsonMapperto use.
-
JacksonJsonMessageConverter
public JacksonJsonMessageConverter(tools.jackson.databind.json.JsonMapper jsonMapper, String... trustedPackages) Construct with the providedJsonMapperinstance.- Parameters:
jsonMapper- theJsonMapperto use.trustedPackages- the trusted Java packages for deserialization- See Also:
-
-
Method Details
-
setUseProjectionForInterfaces
public void setUseProjectionForInterfaces(boolean useProjectionForInterfaces) Set to true to use Spring Data projection to create the object if the inferred parameter type is an interface.- Parameters:
useProjectionForInterfaces- true to use projection.
-
isUseProjectionForInterfaces
protected boolean isUseProjectionForInterfaces() -
convertContent
protected Object convertContent(Message message, @Nullable Object conversionHint, MessageProperties properties, @Nullable String encoding) throws IOException - Overrides:
convertContentin classAbstractJacksonMessageConverter- Throws:
IOException
-