diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceHandler.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceHandler.java
index 951b26a40d..c0312da256 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceHandler.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/IntegrationNamespaceHandler.java
@@ -106,6 +106,7 @@ public class IntegrationNamespaceHandler implements NamespaceHandler {
registerBeanDefinitionParser("aggregator", new AggregatorParser());
registerBeanDefinitionParser("resequencer", new ResequencerParser());
registerBeanDefinitionParser("header-enricher", new StandardHeaderEnricherParser());
+ registerBeanDefinitionParser("object-to-string-transformer", new ObjectToStringTransformerParser());
registerBeanDefinitionParser("inbound-channel-adapter", new MethodInvokingInboundChannelAdapterParser());
registerBeanDefinitionParser("outbound-channel-adapter", new MethodInvokingOutboundChannelAdapterParser());
registerBeanDefinitionParser("gateway", new GatewayParser());
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/ObjectToStringTransformerParser.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/ObjectToStringTransformerParser.java
new file mode 100644
index 0000000000..74c7ab5f01
--- /dev/null
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/ObjectToStringTransformerParser.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2002-2008 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.integration.config.xml;
+
+import org.w3c.dom.Element;
+
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.ParserContext;
+
+/**
+ * Parser for the 'object-to-string-transformer' element.
+ *
+ * @author Mark Fisher
+ */
+public class ObjectToStringTransformerParser extends AbstractTransformerParser {
+
+ @Override
+ protected String getTransformerClassName() {
+ return IntegrationNamespaceUtils.BASE_PACKAGE + ".transformer.ObjectToStringTransformer";
+ }
+
+ @Override
+ protected void parseTransformer(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
+ }
+
+}
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/spring-integration-1.0.xsd b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/spring-integration-1.0.xsd
index 5eb395aabb..7c814e319f 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/spring-integration-1.0.xsd
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/xml/spring-integration-1.0.xsd
@@ -591,6 +591,14 @@
+
+
+
+ Defines a Transformer that converts any Object payload to a String by invoking its toString() method.
+
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/xml/ObjectToStringTransformerParserTests-context.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/xml/ObjectToStringTransformerParserTests-context.xml
new file mode 100644
index 0000000000..e515d9feb7
--- /dev/null
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/xml/ObjectToStringTransformerParserTests-context.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/xml/ObjectToStringTransformerParserTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/config/xml/ObjectToStringTransformerParserTests.java
new file mode 100644
index 0000000000..93198c2ce8
--- /dev/null
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/xml/ObjectToStringTransformerParserTests.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2002-2008 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.integration.config.xml;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.integration.channel.PollableChannel;
+import org.springframework.integration.core.Message;
+import org.springframework.integration.core.MessageChannel;
+import org.springframework.integration.message.GenericMessage;
+import org.springframework.integration.message.StringMessage;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * @author Mark Fisher
+ */
+@ContextConfiguration
+@RunWith(SpringJUnit4ClassRunner.class)
+public class ObjectToStringTransformerParserTests {
+
+ @Autowired
+ @Qualifier("directInput")
+ private MessageChannel directInput;
+
+ @Autowired
+ @Qualifier("queueInput")
+ private MessageChannel queueInput;
+
+ @Autowired
+ @Qualifier("output")
+ private PollableChannel output;
+
+
+ @Test
+ public void directChannelWithStringMessage() {
+ directInput.send(new StringMessage("foo"));
+ Message> result = output.receive(0);
+ assertNotNull(result);
+ assertEquals("foo", result.getPayload());
+ }
+
+ @Test
+ public void queueChannelWithStringMessage() {
+ queueInput.send(new StringMessage("foo"));
+ Message> result = output.receive(3000);
+ assertNotNull(result);
+ assertEquals("foo", result.getPayload());
+ }
+
+ @Test
+ public void directChannelWithObjectMessage() {
+ directInput.send(new GenericMessage(new TestBean()));
+ Message> result = output.receive(0);
+ assertNotNull(result);
+ assertEquals("test", result.getPayload());
+ }
+
+ @Test
+ public void queueChannelWithObjectMessage() {
+ queueInput.send(new GenericMessage(new TestBean()));
+ Message> result = output.receive(3000);
+ assertNotNull(result);
+ assertEquals("test", result.getPayload());
+ }
+
+
+ private static class TestBean {
+
+ public String toString() {
+ return "test";
+ }
+ }
+
+}