From ccb0b8aa8e8ce1c7f1618ce9b813ed1c5abf3b6a Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Wed, 12 Feb 2014 14:12:27 -0500 Subject: [PATCH] INT-3295 Add Doc For Global MessageConverter JIRA: https://jira.springsource.org/browse/INT-3295 Plus test. --- .../channel/config/ChannelParserTests.java | 9 +++++++++ .../config/channelParserGlobalConverterTests.xml | 16 ++++++++++++++++ src/reference/docbook/channel.xml | 5 +++++ 3 files changed, 30 insertions(+) create mode 100644 spring-integration-core/src/test/java/org/springframework/integration/channel/config/channelParserGlobalConverterTests.xml diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java index 2b7ff02f5d..bb734e8476 100644 --- a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/ChannelParserTests.java @@ -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 diff --git a/spring-integration-core/src/test/java/org/springframework/integration/channel/config/channelParserGlobalConverterTests.xml b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/channelParserGlobalConverterTests.xml new file mode 100644 index 0000000000..07f2fb248b --- /dev/null +++ b/spring-integration-core/src/test/java/org/springframework/integration/channel/config/channelParserGlobalConverterTests.xml @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/src/reference/docbook/channel.xml b/src/reference/docbook/channel.xml index efbfc35da9..3e1b08a828 100644 --- a/src/reference/docbook/channel.xml +++ b/src/reference/docbook/channel.xml @@ -521,6 +521,11 @@ payload to an Integer. payload, or a full Message object. If the latter, the converter must be careful to copy all the headers from the inbound message. + + Alternatively, declare a <bean/> of type MessageConverter + with an id "datatypeChannelMessageConverter" and that converter will be used by + all channels with a datatype. +