diff --git a/spring-integration-jms/src/main/java/org/springframework/integration/jms/DefaultJmsHeaderMapper.java b/spring-integration-jms/src/main/java/org/springframework/integration/jms/DefaultJmsHeaderMapper.java index 1e0b054befd..f2cf657ce25 100644 --- a/spring-integration-jms/src/main/java/org/springframework/integration/jms/DefaultJmsHeaderMapper.java +++ b/spring-integration-jms/src/main/java/org/springframework/integration/jms/DefaultJmsHeaderMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2021 the original author or authors. + * Copyright 2002-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,8 +57,9 @@ */ public class DefaultJmsHeaderMapper extends JmsHeaderMapper { - private static final List> SUPPORTED_PROPERTY_TYPES = Arrays.asList(new Class[]{ - Boolean.class, Byte.class, Double.class, Float.class, Integer.class, Long.class, Short.class, String.class }); + private static final List> SUPPORTED_PROPERTY_TYPES = + Arrays.asList(Boolean.class, Byte.class, Double.class, Float.class, Integer.class, Long.class, Short.class, + String.class, byte[].class); private static final Log LOGGER = LogFactory.getLog(DefaultJmsHeaderMapper.class); diff --git a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundChannelAdapterTests.java b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundChannelAdapterTests.java index acec3c7fdb3..a2c115f4aec 100644 --- a/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundChannelAdapterTests.java +++ b/spring-integration-jms/src/test/java/org/springframework/integration/jms/JmsOutboundChannelAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2021 the original author or authors. + * Copyright 2014-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,10 @@ import static org.assertj.core.api.Assertions.assertThat; +import jakarta.jms.JMSException; +import jakarta.jms.Message; +import jakarta.jms.TextMessage; + import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -43,11 +47,19 @@ public class JmsOutboundChannelAdapterTests extends ActiveMQMultiContextTests { private JmsMessageDrivenEndpoint endpoint; @Test - public void testTransactionalSend() { + public void testTransactionalSend() throws JMSException { JmsTemplate template = new JmsTemplate(connectionFactory); - template.convertAndSend("outcatQ1", "Hello, world!"); + template.send("outcatQ1", + session -> { + TextMessage textMessage = + session.createTextMessage("Hello, world!"); + textMessage.setObjectProperty("bytesProperty", "testValue".getBytes()); + return textMessage; + }); template.setReceiveTimeout(20000); - assertThat(template.receive("outcatQ2")).isNotNull(); + Message receive = template.receive("outcatQ2"); + assertThat(receive).isNotNull(); + assertThat(receive.getObjectProperty("bytesProperty")).isEqualTo("testValue".getBytes()); this.aborter.abort = true; template.convertAndSend("outcatQ1", "Hello, world!");