RouterAnnotationPostProcessor now provides the beanFactory reference to the MethodInvokingRouter it creates.
This commit is contained in:
@@ -51,7 +51,7 @@ public abstract class AbstractMethodAnnotationPostProcessor<T extends Annotation
|
||||
private static final String OUTPUT_CHANNEL_ATTRIBUTE = "outputChannel";
|
||||
|
||||
|
||||
private final GenericBeanFactoryAccessor beanFactoryAccessor;
|
||||
protected final GenericBeanFactoryAccessor beanFactoryAccessor;
|
||||
|
||||
protected final ChannelRegistry channelRegistry;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.integration.annotation.Router;
|
||||
import org.springframework.integration.channel.MessageChannel;
|
||||
import org.springframework.integration.message.MessageConsumer;
|
||||
import org.springframework.integration.router.BeanNameChannelMapping;
|
||||
import org.springframework.integration.router.MethodInvokingRouter;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -41,6 +42,7 @@ public class RouterAnnotationPostProcessor extends AbstractMethodAnnotationPostP
|
||||
@Override
|
||||
protected MessageConsumer createConsumer(Object bean, Method method, Router annotation) {
|
||||
MethodInvokingRouter router = new MethodInvokingRouter(bean, method);
|
||||
router.setChannelMapping(new BeanNameChannelMapping(this.beanFactoryAccessor.getBeanFactory()));
|
||||
String defaultOutputChannelName = annotation.defaultOutputChannel();
|
||||
if (StringUtils.hasText(defaultOutputChannelName)) {
|
||||
MessageChannel defaultOutputChannel = this.channelRegistry.lookupChannel(defaultOutputChannelName);
|
||||
|
||||
Reference in New Issue
Block a user