public class Jackson2JsonMessageConverter extends AbstractJsonMessageConverter
DEFAULT_CHARSET| Constructor and Description |
|---|
Jackson2JsonMessageConverter() |
| Modifier and Type | Method and Description |
|---|---|
protected Message |
createMessage(java.lang.Object objectToConvert,
MessageProperties messageProperties)
Crate a message from the payload object and message properties provided.
|
java.lang.Object |
fromMessage(Message message)
Convert from a Message to a Java object.
|
Jackson2JavaTypeMapper |
getJavaTypeMapper() |
Jackson2JavaTypeMapper.TypePrecedence |
getTypePrecedence() |
protected void |
initializeJsonObjectMapper()
Subclass and override to customize.
|
void |
setJavaTypeMapper(Jackson2JavaTypeMapper javaTypeMapper) |
void |
setJsonObjectMapper(com.fasterxml.jackson.databind.ObjectMapper jsonObjectMapper)
The
ObjectMapper to use instead of using the default. |
void |
setTypePrecedence(Jackson2JavaTypeMapper.TypePrecedence typePrecedence)
Set the precedence for evaluating type information in message properties.
|
getClassMapper, getDefaultCharset, setClassMapper, setDefaultCharsetisCreateMessageIds, setCreateMessageIds, toMessagepublic Jackson2JavaTypeMapper getJavaTypeMapper()
public void setJavaTypeMapper(Jackson2JavaTypeMapper javaTypeMapper)
public void setJsonObjectMapper(com.fasterxml.jackson.databind.ObjectMapper jsonObjectMapper)
ObjectMapper to use instead of using the default. An
alternative to injecting a mapper is to extend this class and override
initializeJsonObjectMapper().jsonObjectMapper - the object mapper to setpublic Jackson2JavaTypeMapper.TypePrecedence getTypePrecedence()
setTypePrecedence(Jackson2JavaTypeMapper.TypePrecedence)public void setTypePrecedence(Jackson2JavaTypeMapper.TypePrecedence typePrecedence)
@RabbitListener at the method level, the framework attempts
to determine the target type for payload conversion from the method signature.
If so, this type is provided in the
inferredArgumentType
message property.
By default, if the type is concrete (not abstract, not an interface), this will
be used ahead of type information provided in the __TypeId__ and
associated headers provided by the sender.
If you wish to force the use of the __TypeId__ and associated headers
(such as when the actual type is a subclass of the method argument type),
set the precedence to Jackson2JavaTypeMapper.TypePrecedence.TYPE_ID.
typePrecedence - the precedence.DefaultJackson2JavaTypeMapper.setTypePrecedence(Jackson2JavaTypeMapper.TypePrecedence)protected void initializeJsonObjectMapper()
public java.lang.Object fromMessage(Message message) throws MessageConversionException
MessageConverterfromMessage in interface MessageConverterfromMessage in class AbstractMessageConvertermessage - the message to convertMessageConversionException - in case of conversion failureprotected Message createMessage(java.lang.Object objectToConvert, MessageProperties messageProperties) throws MessageConversionException
AbstractMessageConvertercreateMessage in class AbstractMessageConverterobjectToConvert - the payloadmessageProperties - the message properties (headers)MessageConversionException