Restore setDefaultChannel to MessagingTemplate

Synonym for the Spring setDefaultDestination for backward compatibility.
This commit is contained in:
Gary Russell
2013-12-05 09:21:52 -05:00
parent 7da027ad63
commit 116cedb3c6
2 changed files with 15 additions and 0 deletions

View File

@@ -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);
}
}

View File

@@ -34,6 +34,8 @@ import org.springframework.util.Assert;
* <p>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
*