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 internalJsonMapper
instance and trusted packed to all (*
).JacksonJsonMessageConverter
(String... trustedPackages) Construct with an internalJsonMapper
instance.JacksonJsonMessageConverter
(tools.jackson.databind.json.JsonMapper jsonMapper) Construct with the providedJsonMapper
instance and trusted packed to all (*
).JacksonJsonMessageConverter
(tools.jackson.databind.json.JsonMapper jsonMapper, String... trustedPackages) Construct with the providedJsonMapper
instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
convertContent
(Message message, @Nullable Object conversionHint, MessageProperties properties, @Nullable String encoding) protected boolean
void
setUseProjectionForInterfaces
(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, setTypePrecedence
Methods inherited from class org.springframework.amqp.support.converter.AbstractMessageConverter
isCreateMessageIds, setCreateMessageIds, toMessage, toMessage
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.amqp.support.converter.MessageConverter
toMessage, toMessage
-
Constructor Details
-
JacksonJsonMessageConverter
public JacksonJsonMessageConverter()Construct with an internalJsonMapper
instance and trusted packed to all (*
). -
JacksonJsonMessageConverter
Construct with an internalJsonMapper
instance. TheDeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES
andMapperFeature.DEFAULT_VIEW_INCLUSION
are 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 providedJsonMapper
instance and trusted packed to all (*
).- Parameters:
jsonMapper
- theJsonMapper
to use.
-
JacksonJsonMessageConverter
public JacksonJsonMessageConverter(tools.jackson.databind.json.JsonMapper jsonMapper, String... trustedPackages) Construct with the providedJsonMapper
instance.- Parameters:
jsonMapper
- theJsonMapper
to 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:
convertContent
in classAbstractJacksonMessageConverter
- Throws:
IOException
-