Skip to content

JmsMessagingTemplate is wrongly configured #10305

@filiphr

Description

@filiphr

The configuration for the JmsMessagingTemplate is wrong (at least in my opinion). For the JmsTemplate you can configure the MessageConverter and it will be used. However, that converter is not passed to the JmsMessagingTemplate, and therefore the default one is used.

Maybe this is an issue for spring-jms, but I think that it should be correctly configured. It is not complicated as well. One only needs to get the message converter that the JmsTemplate has.

I think that this would be the solution in the MessagingTemplateConfiguration:

@Bean
@ConditionalOnMissingBean
@ConditionalOnSingleCandidate(JmsTemplate.class)
public JmsMessagingTemplate jmsMessagingTemplate(JmsTemplate jmsTemplate) {
    JmsMessagingTemplate messasgingTemplate = new JmsMessagingTemplate(jmsTemplate)
    if (jmsTemplate.getMessageConverter() != null) {
        messagingTemplate.setConverter(jmsTemplate.getMessageConverter();
    }
    return messagingTemplate;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: declinedA suggestion or change that we don't feel we should currently apply

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions