diff --git a/org.springframework.integration.adapter/src/test/java/org/springframework/integration/adapter/rmi/config/rmiHandlerParserTests.xml b/org.springframework.integration.adapter/src/test/java/org/springframework/integration/adapter/rmi/config/rmiHandlerParserTests.xml
index b376a360a9..c0086b1c91 100644
--- a/org.springframework.integration.adapter/src/test/java/org/springframework/integration/adapter/rmi/config/rmiHandlerParserTests.xml
+++ b/org.springframework.integration.adapter/src/test/java/org/springframework/integration/adapter/rmi/config/rmiHandlerParserTests.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/cafe/cafeDemo.xml b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/cafe/cafeDemo.xml
index 9a63405d42..26c5a5e154 100644
--- a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/cafe/cafeDemo.xml
+++ b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/cafe/cafeDemo.xml
@@ -20,8 +20,8 @@
-
-
+
+
diff --git a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-common.xml b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-common.xml
index aa51a65806..8756085849 100644
--- a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-common.xml
+++ b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-common.xml
@@ -20,7 +20,7 @@
+ ref="exclaimer" method="exclaim"/>
diff --git a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-text.xml b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-text.xml
index de0faec939..ed6de5f505 100644
--- a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-text.xml
+++ b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/filecopy/fileCopyDemo-text.xml
@@ -9,6 +9,8 @@
-
+
diff --git a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/helloworld/helloWorldDemo.xml b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/helloworld/helloWorldDemo.xml
index c491f8c3de..c8f903c49a 100644
--- a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/helloworld/helloWorldDemo.xml
+++ b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/helloworld/helloWorldDemo.xml
@@ -11,7 +11,7 @@
diff --git a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/temperatureConversion.xml b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/temperatureConversion.xml
index 16a5e00f01..565dcc3daf 100644
--- a/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/temperatureConversion.xml
+++ b/org.springframework.integration.samples/src/main/java/org/springframework/integration/samples/ws/temperatureConversion.xml
@@ -15,7 +15,7 @@
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/HandlerEndpointParser.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/AbstractHandlerEndpointParser.java
similarity index 66%
rename from org.springframework.integration/src/main/java/org/springframework/integration/config/HandlerEndpointParser.java
rename to org.springframework.integration/src/main/java/org/springframework/integration/config/AbstractHandlerEndpointParser.java
index 8cd8c32f07..0c35187761 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/config/HandlerEndpointParser.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/AbstractHandlerEndpointParser.java
@@ -20,48 +20,48 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.config.BeanDefinitionHolder;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
import org.springframework.beans.factory.support.ManagedList;
-import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.ConfigurationException;
import org.springframework.integration.endpoint.HandlerEndpoint;
-import org.springframework.integration.handler.DefaultMessageHandlerAdapter;
+import org.springframework.integration.handler.MessageHandler;
import org.springframework.integration.scheduling.PollingSchedule;
import org.springframework.integration.scheduling.Schedule;
import org.springframework.util.StringUtils;
/**
- * Parser for the handler-endpoint element of the integration namespace.
+ * Base class parser for elements that create handler-invoking endpoints.
*
* @author Mark Fisher
*/
-public class HandlerEndpointParser extends AbstractSingleBeanDefinitionParser {
+public abstract class AbstractHandlerEndpointParser extends AbstractSingleBeanDefinitionParser {
- private static final String INPUT_CHANNEL_ATTRIBUTE = "input-channel";
+ protected static final String REF_ATTRIBUTE = "ref";
- private static final String OUTPUT_CHANNEL_ATTRIBUTE = "output-channel";
+ protected static final String METHOD_ATTRIBUTE = "method";
- private static final String OUTPUT_CHANNEL_PROPERTY = "outputChannelName";
+ protected static final String INPUT_CHANNEL_ATTRIBUTE = "input-channel";
- private static final String RETURN_ADDRESS_OVERRIDES_ATTRIBUTE = "return-address-overrides";
+ protected static final String OUTPUT_CHANNEL_ATTRIBUTE = "output-channel";
- private static final String REPLY_HANDLER_ATTRIBUTE = "reply-handler";
+ protected static final String OUTPUT_CHANNEL_PROPERTY = "outputChannelName";
- private static final String REPLY_HANDLER_PROPERTY = "replyHandler";
-
- private static final String SELECTOR_ATTRIBUTE = "selector";
-
- private static final String SELECTOR_PROPERTY = "messageSelector";
+ protected static final String RETURN_ADDRESS_OVERRIDES_ATTRIBUTE = "return-address-overrides";
private static final String PERIOD_ATTRIBUTE = "period";
private static final String SCHEDULE_ELEMENT = "schedule";
+ private static final String SELECTOR_ATTRIBUTE = "selector";
+
+ private static final String SELECTOR_PROPERTY = "messageSelector";
+
private static final String INTERCEPTORS_ELEMENT = "interceptors";
@@ -82,17 +82,17 @@ public class HandlerEndpointParser extends AbstractSingleBeanDefinitionParser {
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
- String handler = element.getAttribute("handler");
- if (!StringUtils.hasText(handler)) {
- throw new ConfigurationException("The 'handler' attribute is required.");
+ String ref = element.getAttribute(REF_ATTRIBUTE);
+ if (!StringUtils.hasText(ref)) {
+ throw new ConfigurationException("The '" + REF_ATTRIBUTE + "' attribute is required.");
}
- String method = element.getAttribute("method");
+ String method = element.getAttribute(METHOD_ATTRIBUTE);
if (StringUtils.hasText(method)) {
- String adapterBeanName = this.parseAdapter(handler, method, parserContext);
+ String adapterBeanName = this.parseAdapter(ref, method, element, parserContext);
builder.addConstructorArgReference(adapterBeanName);
}
else {
- builder.addConstructorArgReference(handler);
+ builder.addConstructorArgReference(ref);
}
String inputChannelName = element.getAttribute(INPUT_CHANNEL_ATTRIBUTE);
Schedule schedule = null;
@@ -129,18 +129,26 @@ public class HandlerEndpointParser extends AbstractSingleBeanDefinitionParser {
String returnAddressOverridesAttribute = element.getAttribute(RETURN_ADDRESS_OVERRIDES_ATTRIBUTE);
boolean returnAddressOverrides = "true".equals(returnAddressOverridesAttribute);
builder.addPropertyValue("returnAddressOverrides", returnAddressOverrides);
- String replyHandler = element.getAttribute(REPLY_HANDLER_ATTRIBUTE);
- if (StringUtils.hasText(replyHandler)) {
- builder.addPropertyValue(REPLY_HANDLER_PROPERTY, new RuntimeBeanReference(replyHandler));
- }
+ this.postProcessEndpointBean(builder, element, parserContext);
}
- private String parseAdapter(String ref, String method, ParserContext parserContext) {
- BeanDefinition adapterDef = new RootBeanDefinition(DefaultMessageHandlerAdapter.class);
- adapterDef.getPropertyValues().addPropertyValue("object", new RuntimeBeanReference(ref));
- adapterDef.getPropertyValues().addPropertyValue("methodName", method);
- String adapterBeanName = parserContext.getReaderContext().generateBeanName(adapterDef);
- parserContext.registerBeanComponent(new BeanComponentDefinition(adapterDef, adapterBeanName));
+ protected abstract Class extends MessageHandler> getHandlerAdapterClass();
+
+ protected void postProcessEndpointBean(BeanDefinitionBuilder builder, Element element, ParserContext parserContext) {
+ }
+
+ protected void postProcessAdapterBean(BeanDefinitionBuilder builder, Element element, ParserContext parserContext) {
+ }
+
+
+ private String parseAdapter(String ref, String method, Element element, ParserContext parserContext) {
+ BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(this.getHandlerAdapterClass());
+ builder.addPropertyValue("object", new RuntimeBeanReference(ref));
+ builder.addPropertyValue("methodName", method);
+ String adapterBeanName = BeanDefinitionReaderUtils.generateBeanName(builder.getBeanDefinition(), parserContext.getRegistry());
+ this.postProcessAdapterBean(builder, element, parserContext);
+ BeanDefinitionHolder holder = new BeanDefinitionHolder(builder.getBeanDefinition(), adapterBeanName);
+ parserContext.registerBeanComponent(new BeanComponentDefinition(holder));
return adapterBeanName;
}
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/DefaultHandlerEndpointParser.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/DefaultHandlerEndpointParser.java
new file mode 100644
index 0000000000..ae2ee30545
--- /dev/null
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/DefaultHandlerEndpointParser.java
@@ -0,0 +1,51 @@
+/*
+ * 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;
+
+import org.w3c.dom.Element;
+
+import org.springframework.beans.factory.config.RuntimeBeanReference;
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.springframework.beans.factory.xml.ParserContext;
+import org.springframework.integration.handler.DefaultMessageHandlerAdapter;
+import org.springframework.integration.handler.MessageHandler;
+import org.springframework.util.StringUtils;
+
+/**
+ * @author Mark Fisher
+ */
+public class DefaultHandlerEndpointParser extends AbstractHandlerEndpointParser {
+
+ private static final String REPLY_HANDLER_ATTRIBUTE = "reply-handler";
+
+ private static final String REPLY_HANDLER_PROPERTY = "replyHandler";
+
+
+ @Override
+ protected Class extends MessageHandler> getHandlerAdapterClass() {
+ return DefaultMessageHandlerAdapter.class;
+ }
+
+ @Override
+ protected void postProcessEndpointBean(BeanDefinitionBuilder builder, Element element, ParserContext parserContext) {
+ String replyHandler = element.getAttribute(REPLY_HANDLER_ATTRIBUTE);
+ if (StringUtils.hasText(replyHandler)) {
+ builder.addPropertyValue(REPLY_HANDLER_PROPERTY, new RuntimeBeanReference(replyHandler));
+ }
+ }
+
+}
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/IntegrationNamespaceHandler.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/IntegrationNamespaceHandler.java
index f02dab11f9..c08b013ac9 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/config/IntegrationNamespaceHandler.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/IntegrationNamespaceHandler.java
@@ -64,7 +64,7 @@ public class IntegrationNamespaceHandler extends NamespaceHandlerSupport {
registerBeanDefinitionParser("priority-channel", new PriorityChannelParser());
registerBeanDefinitionParser("rendezvous-channel", new RendezvousChannelParser());
registerBeanDefinitionParser("thread-local-channel", new ThreadLocalChannelParser());
- registerBeanDefinitionParser("handler-endpoint", new HandlerEndpointParser());
+ registerBeanDefinitionParser("handler-endpoint", new DefaultHandlerEndpointParser());
registerBeanDefinitionParser("channel-adapter", new ChannelAdapterParser());
registerBeanDefinitionParser("gateway", new GatewayParser());
registerBeanDefinitionParser("handler", new HandlerParser());
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessor.java b/org.springframework.integration/src/main/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessor.java
index 6b36ab3a9f..6aa3d754d4 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessor.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/annotation/MessagingAnnotationPostProcessor.java
@@ -92,6 +92,9 @@ public class MessagingAnnotationPostProcessor implements BeanPostProcessor, Init
if (bean instanceof ChannelRegistryAware) {
((ChannelRegistryAware) bean).setChannelRegistry(this.messageBus);
}
+ if (!bean.equals(originalBean) && originalBean instanceof ChannelRegistryAware) {
+ ((ChannelRegistryAware) originalBean).setChannelRegistry(this.messageBus);
+ }
if (endpointAnnotation != null && bean.equals(originalBean)) {
throw new ConfigurationException("Class [" + beanClass.getName()
+ "] is annotated with @MessageEndpoint but contains no source, target, or handler method annotations.");
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd b/org.springframework.integration/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd
index 54364546ba..65644668ab 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/config/spring-integration-core-1.0.xsd
@@ -200,23 +200,35 @@
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+ Base type for handler endpoint elements.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -319,18 +331,12 @@
-
-
-
-
+
+
+
Defines a Splitter.
-
-
-
-
-
-
-
+
+
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/handler/AbstractMessageHandlerAdapter.java b/org.springframework.integration/src/main/java/org/springframework/integration/handler/AbstractMessageHandlerAdapter.java
index 0af04a54f6..1356b2522e 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/handler/AbstractMessageHandlerAdapter.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/handler/AbstractMessageHandlerAdapter.java
@@ -19,7 +19,8 @@ package org.springframework.integration.handler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import org.springframework.core.Ordered;
+import org.springframework.integration.channel.ChannelRegistry;
+import org.springframework.integration.channel.ChannelRegistryAware;
import org.springframework.integration.message.DefaultMessageCreator;
import org.springframework.integration.message.DefaultMessageMapper;
import org.springframework.integration.message.Message;
@@ -44,19 +45,20 @@ import org.springframework.util.ObjectUtils;
*
* @author Mark Fisher
*/
-public abstract class AbstractMessageHandlerAdapter extends AbstractMethodInvokingAdapter implements MessageHandler {
+public abstract class AbstractMessageHandlerAdapter extends AbstractMethodInvokingAdapter
+ implements MessageHandler, ChannelRegistryAware {
public static final String OUTPUT_CHANNEL_NAME_KEY = "outputChannelName";
- private volatile int order;
-
private volatile boolean methodExpectsMessage;
private volatile MessageMapper messageMapper = new DefaultMessageMapper();
private volatile MessageCreator messageCreator = new DefaultMessageCreator();
+ private volatile ChannelRegistry channelRegistry;
+
public void setMethodExpectsMessage(boolean methodExpectsMessage) {
this.methodExpectsMessage = methodExpectsMessage;
@@ -72,6 +74,14 @@ public abstract class AbstractMessageHandlerAdapter extends AbstractMethodInvoki
this.messageCreator = messageCreator;
}
+ public void setChannelRegistry(ChannelRegistry channelRegistry) {
+ this.channelRegistry = channelRegistry;
+ }
+
+ protected ChannelRegistry getChannelRegistry() {
+ return this.channelRegistry;
+ }
+
public Message> handle(Message> message) {
if (!this.isInitialized()) {
this.afterPropertiesSet();
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/router/SplitterMessageHandlerAdapter.java b/org.springframework.integration/src/main/java/org/springframework/integration/router/SplitterMessageHandlerAdapter.java
index c7625bc801..d935c20c7b 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/router/SplitterMessageHandlerAdapter.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/router/SplitterMessageHandlerAdapter.java
@@ -26,7 +26,6 @@ import org.springframework.integration.channel.ChannelRegistryAware;
import org.springframework.integration.channel.MessageChannel;
import org.springframework.integration.handler.AbstractMessageHandlerAdapter;
import org.springframework.integration.message.Message;
-import org.springframework.util.Assert;
/**
* MessageHandler adapter for methods annotated with {@link Splitter @Splitter}.
@@ -36,18 +35,14 @@ import org.springframework.util.Assert;
*/
public class SplitterMessageHandlerAdapter extends AbstractMessageHandlerAdapter implements ChannelRegistryAware {
- private final String outputChannelName;
-
- private volatile ChannelRegistry channelRegistry;
+ private volatile String outputChannelName;
private volatile long sendTimeout = -1;
- public SplitterMessageHandlerAdapter(Object object, Method method, String outputChannelName) {
- Assert.hasText(outputChannelName, "output channel name is required");
+ public SplitterMessageHandlerAdapter(Object object, Method method) {
this.setObject(object);
this.setMethod(method);
- this.outputChannelName = outputChannelName;
if (method.getParameterTypes().length < 1) {
throw new ConfigurationException("The splitter method must accept at least one argument.");
}
@@ -56,15 +51,17 @@ public class SplitterMessageHandlerAdapter extends AbstractMessageHandlerAdapter
}
}
- public SplitterMessageHandlerAdapter(Object object, String methodName, String outputChannelName) {
- Assert.hasText(outputChannelName, "output channel name is required");
+ public SplitterMessageHandlerAdapter(Object object, String methodName) {
this.setObject(object);
this.setMethodName(methodName);
- this.outputChannelName = outputChannelName;
}
- public void setChannelRegistry(ChannelRegistry channelRegistry) {
- this.channelRegistry = channelRegistry;
+ public SplitterMessageHandlerAdapter() {
+ }
+
+
+ public void setOutputChannelName(String outputChannelName) {
+ this.outputChannelName = outputChannelName;
}
public void setSendTimeout(long sendTimeout) {
@@ -115,10 +112,11 @@ public class SplitterMessageHandlerAdapter extends AbstractMessageHandlerAdapter
}
private boolean sendMessage(Message> message, String channelName) {
- if (this.channelRegistry == null) {
+ ChannelRegistry channelRegistry = this.getChannelRegistry();
+ if (channelRegistry == null) {
throw new IllegalStateException(this.getClass().getSimpleName() + " requires a ChannelRegistry reference.");
}
- MessageChannel channel = this.channelRegistry.lookupChannel(channelName);
+ MessageChannel channel = channelRegistry.lookupChannel(channelName);
if (channel == null) {
if (logger.isWarnEnabled()) {
logger.warn("unable to resolve channel for name '" + channelName + "'");
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/router/config/SplitterMessageHandlerCreator.java b/org.springframework.integration/src/main/java/org/springframework/integration/router/config/SplitterMessageHandlerCreator.java
index 914b054863..596449df3c 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/router/config/SplitterMessageHandlerCreator.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/router/config/SplitterMessageHandlerCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * 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.
@@ -42,7 +42,9 @@ public class SplitterMessageHandlerCreator extends AbstractMessageHandlerCreator
outputChannelName = endpointAnnotation.output();
}
}
- return new SplitterMessageHandlerAdapter(object, method, outputChannelName);
+ SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(object, method);
+ adapter.setOutputChannelName(outputChannelName);
+ return adapter;
}
}
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/router/config/SplitterParser.java b/org.springframework.integration/src/main/java/org/springframework/integration/router/config/SplitterParser.java
index 699a1ea8f9..f7dfdc4cb3 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/router/config/SplitterParser.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/router/config/SplitterParser.java
@@ -19,8 +19,10 @@ package org.springframework.integration.router.config;
import org.w3c.dom.Element;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
+import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.ConfigurationException;
+import org.springframework.integration.config.AbstractHandlerEndpointParser;
+import org.springframework.integration.handler.MessageHandler;
import org.springframework.integration.router.SplitterMessageHandlerAdapter;
import org.springframework.util.StringUtils;
@@ -29,25 +31,20 @@ import org.springframework.util.StringUtils;
*
* @author Mark Fisher
*/
-public class SplitterParser extends AbstractSingleBeanDefinitionParser {
+public class SplitterParser extends AbstractHandlerEndpointParser {
@Override
- protected Class> getBeanClass(Element element) {
+ protected Class extends MessageHandler> getHandlerAdapterClass() {
return SplitterMessageHandlerAdapter.class;
}
@Override
- protected void doParse(Element element, BeanDefinitionBuilder builder) {
- String ref = element.getAttribute("ref");
- String methodName = element.getAttribute("method");
+ protected void postProcessAdapterBean(BeanDefinitionBuilder builder, Element element, ParserContext parserContext) {
String outputChannelName = element.getAttribute("output-channel");
- if (!StringUtils.hasText(ref) || !StringUtils.hasText(methodName) || !StringUtils.hasText(outputChannelName)) {
- throw new ConfigurationException(
- "The 'ref', 'method', and 'output-channel' attributes are all required.");
+ if (!StringUtils.hasText(outputChannelName)) {
+ throw new ConfigurationException("The 'output-channel' attribute is required.");
}
- builder.addConstructorArgReference(ref);
- builder.addConstructorArgValue(methodName);
- builder.addConstructorArgValue(outputChannelName);
+ builder.addPropertyValue("outputChannelName", outputChannelName);
}
}
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/handlerAnnotationPostProcessorTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/handlerAnnotationPostProcessorTests.xml
index 0201c658c5..19379dad8f 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/handlerAnnotationPostProcessorTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/annotation/handlerAnnotationPostProcessorTests.xml
@@ -12,7 +12,7 @@
-
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithHandlerChainElement.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithHandlerChainElement.xml
index 28aa3fbf92..e92b9ba6a1 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithHandlerChainElement.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithHandlerChainElement.xml
@@ -19,7 +19,7 @@
-
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithReplyHandler.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithReplyHandler.xml
index d6f73a3fe9..58394cf452 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithReplyHandler.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithReplyHandler.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithSelector.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithSelector.xml
index be3af7efb4..51753dd386 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithSelector.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/endpointWithSelector.xml
@@ -12,7 +12,7 @@
+ ref="testHandler" selector="typeSelector">
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/handlerAdapterEndpointTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/handlerAdapterEndpointTests.xml
index 8c7b102982..3228d4ebc3 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/handlerAdapterEndpointTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/handlerAdapterEndpointTests.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/messageEndpointBeanPostProcessorTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/messageEndpointBeanPostProcessorTests.xml
index 59ef1256a0..cd3ce0699e 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/messageEndpointBeanPostProcessorTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/messageEndpointBeanPostProcessorTests.xml
@@ -15,14 +15,14 @@
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/config/simpleEndpointTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/config/simpleEndpointTests.xml
index a23a020750..12dc2d03b3 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/config/simpleEndpointTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/config/simpleEndpointTests.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/interceptor/transactionInterceptorPropagationTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/interceptor/transactionInterceptorPropagationTests.xml
index d59e8184d4..f80db357fa 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/interceptor/transactionInterceptorPropagationTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/interceptor/transactionInterceptorPropagationTests.xml
@@ -14,7 +14,7 @@
@@ -25,7 +25,7 @@
@@ -36,7 +36,7 @@
@@ -47,7 +47,7 @@
@@ -58,7 +58,7 @@
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/interceptor/transactionInterceptorTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/interceptor/transactionInterceptorTests.xml
index fb858732e3..02b8400d35 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/interceptor/transactionInterceptorTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/interceptor/transactionInterceptorTests.xml
@@ -14,7 +14,7 @@
@@ -24,7 +24,7 @@
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/returnAddressTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/returnAddressTests.xml
index f82040f66f..c2388cc476 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/returnAddressTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/endpoint/returnAddressTests.xml
@@ -18,16 +18,16 @@
-
-
-
-
-
-
+
+
+
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/gateway/gatewayWithRendezvousChannel.xml b/org.springframework.integration/src/test/java/org/springframework/integration/gateway/gatewayWithRendezvousChannel.xml
index 5023968960..e0e0143d86 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/gateway/gatewayWithRendezvousChannel.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/gateway/gatewayWithRendezvousChannel.xml
@@ -11,7 +11,7 @@
-
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/gateway/gatewayWithResponseCorrelator.xml b/org.springframework.integration/src/test/java/org/springframework/integration/gateway/gatewayWithResponseCorrelator.xml
index 2ec396c67c..cd57632c47 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/gateway/gatewayWithResponseCorrelator.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/gateway/gatewayWithResponseCorrelator.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/handler/CorrelationIdTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/handler/CorrelationIdTests.java
index 20db84b229..9579aa4ccb 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/handler/CorrelationIdTests.java
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/handler/CorrelationIdTests.java
@@ -121,7 +121,8 @@ public class CorrelationIdTests {
ChannelRegistry channelRegistry = new DefaultChannelRegistry();
channelRegistry.registerChannel("testChannel", testChannel);
SplitterMessageHandlerAdapter splitter = new SplitterMessageHandlerAdapter(
- new TestBean(), TestBean.class.getMethod("split", String.class), "testChannel");
+ new TestBean(), TestBean.class.getMethod("split", String.class));
+ splitter.setOutputChannelName("testChannel");
splitter.setChannelRegistry(channelRegistry);
splitter.afterPropertiesSet();
splitter.handle(message);
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/router/SplitterMessageHandlerAdapterTests.java b/org.springframework.integration/src/test/java/org/springframework/integration/router/SplitterMessageHandlerAdapterTests.java
index 32bab71417..6ddd9403f6 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/router/SplitterMessageHandlerAdapterTests.java
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/router/SplitterMessageHandlerAdapterTests.java
@@ -157,7 +157,8 @@ public class SplitterMessageHandlerAdapterTests {
@Test(expected=MessagingException.class)
public void testInvalidReturnType() throws Exception {
Method splittingMethod = this.testBean.getClass().getMethod("invalidParameterCount", String.class, String.class);
- SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(testBean, splittingMethod, "testChannel");
+ SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(testBean, splittingMethod);
+ adapter.setOutputChannelName("testChannel");
adapter.setChannelRegistry(channelRegistry);
adapter.afterPropertiesSet();
StringMessage message = new StringMessage("foo.bar");
@@ -167,8 +168,9 @@ public class SplitterMessageHandlerAdapterTests {
@Test
public void testSplitPayloadToStringArrayConfiguredByMethodName() throws Exception {
StringMessage message = new StringMessage("foo.bar");
- SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(
- testBean, "stringToStringArray", "testChannel");
+ SplitterMessageHandlerAdapter adapter =
+ new SplitterMessageHandlerAdapter(testBean, "stringToStringArray");
+ adapter.setOutputChannelName("testChannel");
adapter.setChannelRegistry(channelRegistry);
adapter.afterPropertiesSet();
adapter.handle(message);
@@ -183,8 +185,9 @@ public class SplitterMessageHandlerAdapterTests {
@Test
public void testSplitMessageToStringArrayConfiguredByMethodName() throws Exception {
StringMessage message = new StringMessage("foo.bar");
- SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(
- testBean, "messageToStringArray", "testChannel");
+ SplitterMessageHandlerAdapter adapter =
+ new SplitterMessageHandlerAdapter(testBean, "messageToStringArray");
+ adapter.setOutputChannelName("testChannel");
adapter.setChannelRegistry(channelRegistry);
adapter.afterPropertiesSet();
adapter.handle(message);
@@ -199,8 +202,9 @@ public class SplitterMessageHandlerAdapterTests {
@Test
public void testSplitStringToMessageListConfiguredByMethodName() throws Exception {
StringMessage message = new StringMessage("foo.bar");
- SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(
- testBean, "stringToMessageList", "testChannel");
+ SplitterMessageHandlerAdapter adapter =
+ new SplitterMessageHandlerAdapter(testBean, "stringToMessageList");
+ adapter.setOutputChannelName("testChannel");
adapter.setChannelRegistry(channelRegistry);
adapter.afterPropertiesSet();
adapter.handle(message);
@@ -250,7 +254,9 @@ public class SplitterMessageHandlerAdapterTests {
private SplitterMessageHandlerAdapter getAdapter(String methodName) throws Exception {
Class> paramType = methodName.startsWith("message") ? Message.class : String.class;
Method splittingMethod = this.testBean.getClass().getMethod(methodName, paramType);
- SplitterMessageHandlerAdapter adapter = new SplitterMessageHandlerAdapter(testBean, splittingMethod, "testChannel");
+ SplitterMessageHandlerAdapter adapter =
+ new SplitterMessageHandlerAdapter(testBean, splittingMethod);
+ adapter.setOutputChannelName("testChannel");
adapter.setChannelRegistry(channelRegistry);
adapter.afterPropertiesSet();
return adapter;
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/router/config/routerParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/router/config/routerParserTests.xml
index 511a378aed..3735eab4f2 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/router/config/routerParserTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/router/config/routerParserTests.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/org.springframework.integration/src/test/java/org/springframework/integration/router/config/splitterParserTests.xml b/org.springframework.integration/src/test/java/org/springframework/integration/router/config/splitterParserTests.xml
index 24372693ec..ca2a276054 100644
--- a/org.springframework.integration/src/test/java/org/springframework/integration/router/config/splitterParserTests.xml
+++ b/org.springframework.integration/src/test/java/org/springframework/integration/router/config/splitterParserTests.xml
@@ -13,9 +13,8 @@
-
-
-
+