简体   繁体   English

Spring Integration Gateway错误通道-没有此类bean异常

[英]Spring Integration gateway error channel - no such bean exception

I've configured a spring integration gateway with a service activator backed by a threadpool. 我已经配置了一个带有线程池支持的服务激活器的spring集成网关。 Everything works fine, till I try to add my own error channel. 一切正常,直到我尝试添加自己的错误通道。 Spring begins to complain that it cannot find a bean by the name of the error channel. Spring开始抱怨它无法通过错误通道的名称找到一个bean。

Here is my xml config: 这是我的xml配置:

    <int:gateway service-interface="Messaging.SendMessageToDeviceGateWay"
        error-channel="send_message_to_device_error_channel"
        default-request-channel="send_message_to_device_channel" 
        id="send_message_to_device_gateway">

        </int:gateway>

    <int:channel id="send_message_to_device_channel">
        <int:queue message-store="redisMessageStore" />
    </int:channel>

    <bean id="sendMessageToDeviceServiceBeanId" class="Messaging.SendMessageToDeviceService" />

    <int:service-activator input-channel="send_message_to_device_channel"
        ref="sendMessageToDeviceServiceBeanId" method="send_message">
        <int:poller fixed-rate="500" time-unit="MILLISECONDS"
            task-executor="send_message_to_device_task_executor" receive-timeout="0" />
    </int:service-activator>


    <bean id="sendMessageToDeviceErrorHandlerBeanId" 
        class="Messaging.SendMessageToDeviceErrorHandler" />



    <int:service-activator input-channel = "send_message_to_device_error_channel"
        ref="sendMessageToDeviceErrorHandlerBeanId" method="handle_error">
    </int:service-activator>

The error I am seeing is : 我看到的错误是:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'send_message_to_device_gateway': Cannot resolve reference to bean 'send_message_to_device_error_channel' while setting bean property 'errorChannel'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'send_message_to_device_error_channel' is defined
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1469)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1127)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1051)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
... 24 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'send_message_to_device_error_channel' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:694)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1168)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:281)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
... 37 more

Why is it looking for a bean by that name? 为什么要寻找那个名字的豆子?

Thanks in advance, Richard. 预先感谢,理查德。

That's correct: any bean must be presented in the application context. 没错:任何bean必须在应用程序上下文中显示。

Even if you use a default errorChannel , it is populated to the application context by the Spring Integration infrastructure. 即使使用默认的errorChannel ,Spring Integration基础结构errorChannel其填充到应用程序上下文中。

So, you must provide <channel id="send_message_to_device_error_channel"/> anyway. 因此,无论如何,您必须提供<channel id="send_message_to_device_error_channel"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM