INT-3295 Add Doc For Global MessageConverter
JIRA: https://jira.springsource.org/browse/INT-3295 Plus test.
This commit is contained in:
@@ -166,6 +166,15 @@ public class ChannelParserTests {
|
||||
assertTrue(TestUtils.getPropertyValue(channel, "messageConverter") instanceof UselessMessageConverter);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDatatypeChannelGlobalConverter() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("channelParserGlobalConverterTests.xml", this
|
||||
.getClass());
|
||||
MessageChannel channel = context.getBean("integerChannel", MessageChannel.class);
|
||||
context.close();
|
||||
assertTrue(TestUtils.getPropertyValue(channel, "messageConverter") instanceof UselessMessageConverter);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDatatypeChannelWithAssignableSubTypes() {
|
||||
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("channelParserTests.xml", this
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd">
|
||||
|
||||
<channel id="integerChannel" datatype="java.lang.Integer">
|
||||
<queue capacity="10" />
|
||||
</channel>
|
||||
|
||||
<beans:bean id="datatypeChannelMessageConverter"
|
||||
class="org.springframework.integration.channel.config.ChannelParserTests$UselessMessageConverter" />
|
||||
|
||||
</beans:beans>
|
||||
@@ -521,6 +521,11 @@ payload to an Integer.
|
||||
payload, or a full <classname>Message</classname> object. If the latter, the converter must
|
||||
be careful to copy all the headers from the inbound message.
|
||||
</para>
|
||||
<para>
|
||||
Alternatively, declare a <code><bean/></code> of type <interfacename>MessageConverter</interfacename>
|
||||
with an id <code>"datatypeChannelMessageConverter"</code> and that converter will be used by
|
||||
all channels with a <code>datatype</code>.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="channel-configuration-queuechannel">
|
||||
|
||||
Reference in New Issue
Block a user