From cd81f244511ea12792c1bba9ce02dea11bbd9d11 Mon Sep 17 00:00:00 2001 From: Marius Bogoevici Date: Wed, 6 Apr 2016 14:08:56 -0400 Subject: [PATCH] Make bindable channel validation more consistent. --- .../stream/binding/BindableProxyFactory.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindableProxyFactory.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindableProxyFactory.java index 27776221d..9f968b0ee 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindableProxyFactory.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindableProxyFactory.java @@ -21,11 +21,6 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; -import org.aopalliance.intercept.MethodInterceptor; -import org.aopalliance.intercept.MethodInvocation; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.springframework.aop.framework.ProxyFactory; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.InitializingBean; @@ -41,6 +36,11 @@ import org.springframework.messaging.SubscribableChannel; import org.springframework.util.Assert; import org.springframework.util.ReflectionUtils; +import org.aopalliance.intercept.MethodInterceptor; +import org.aopalliance.intercept.MethodInvocation; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + /** * {@link FactoryBean} for instantiating the interfaces specified via * {@link EnableBinding} @@ -108,8 +108,7 @@ public class BindableProxyFactory implements MethodInterceptor, FactoryBean channelType) { + Assert.isTrue(SubscribableChannel.class.equals(channelType) || MessageChannel.class.equals(channelType), + "A bound channel should be either a '" + MessageChannel.class.getName() + "', " + + " or a '" + SubscribableChannel.class.getName() + "'"); + } + private MessageChannel locateSharedChannel(String name) { return this.sharedChannelRegistry != null ? this.sharedChannelRegistry.get(getNamespacePrefixedChannelName(name)) : null;