diff --git a/spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java b/spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java index b1572d7395..f16ade2362 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/core/MessagingTemplate.java @@ -18,6 +18,7 @@ package org.springframework.integration.core; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.integration.support.channel.BeanFactoryChannelResolver; +import org.springframework.messaging.MessageChannel; import org.springframework.messaging.core.GenericMessagingTemplate; /** @@ -27,9 +28,21 @@ import org.springframework.messaging.core.GenericMessagingTemplate; */ public class MessagingTemplate extends GenericMessagingTemplate { + /** + * Overridden to set the destination resolver to a {@link BeanFactoryChannelResolver}. + */ @Override public void setBeanFactory(BeanFactory beanFactory) throws BeansException { super.setDestinationResolver(new BeanFactoryChannelResolver(beanFactory)); } + /** + * Invokes {@link #setDefaultDestination(MessageChannel)} - provided for + * backward compatibility. + * @param channel the channel to set. + */ + public void setDefaultChannel(MessageChannel channel) { + super.setDefaultDestination(channel); + } + } diff --git a/spring-integration-core/src/main/java/org/springframework/integration/support/channel/BeanFactoryChannelResolver.java b/spring-integration-core/src/main/java/org/springframework/integration/support/channel/BeanFactoryChannelResolver.java index c47d93b85a..4ebce0b8d7 100644 --- a/spring-integration-core/src/main/java/org/springframework/integration/support/channel/BeanFactoryChannelResolver.java +++ b/spring-integration-core/src/main/java/org/springframework/integration/support/channel/BeanFactoryChannelResolver.java @@ -34,6 +34,8 @@ import org.springframework.util.Assert; *
Will lookup Spring managed beans identified by bean name, * expecting them to be of type {@link MessageChannel}. * + * Consults a {@link HeaderChannelRegistry}, if available, if the bean is not found. + * * @author Mark Fisher * @author Gary Russell *