Spring integration Spring集成:在Bean中注入QueueChannel以计算剩余容量时出错

Spring integration Spring集成:在Bean中注入QueueChannel以计算剩余容量时出错,spring-integration,Spring Integration,我想在bean中注入一个QueueChannel,以便监视它的剩余容量。如果有人能指导我解决这个问题,那就太好了 以下是我的配置: <si:channel id="queueChannel"> <si:queue capacity="200"/> </si:channel> <bean id="inboundAdapterPollingConfiguration" class="com.foo.impl.InboundAdapterPolling

我想在bean中注入一个QueueChannel,以便监视它的剩余容量。如果有人能指导我解决这个问题,那就太好了

以下是我的配置:

<si:channel id="queueChannel">
    <si:queue capacity="200"/>
</si:channel>
<bean id="inboundAdapterPollingConfiguration" class="com.foo.impl.InboundAdapterPollingConfigurationImpl">
        <property name="channel" ref="queueChannel"/>
        <property name="jdbcInboundAdapter" ref="jdbcInboundAdapter"/>      
    </bean>
错误:

java.lang.IllegalStateException: Cannot convert value of type 
[$Proxy336 implementing org.springframework.integration.core.PollableChannel,  
org.springframework.integration.MessageChannel] to required type  
[org.springframework.integration.channel.QueueChannel] 
for property 'channel': no matching editors or conversion strategy found

当您启用JMX时,通道、端点等将包装在代理中;这意味着您只能使用接口(例如
MessageChannel
)注入它们。我们正在寻找一些选项,以使这在将来变得更容易,但现在,您必须打开代理才能访问底层的
QueueChannel
对象

约翰,在我们的聊天中你说:

我使用JMX导出来获取应用程序中TaskExecutor的信息,并动态修改它

因此,不需要为您的案例与代理抗争,因为
具有属性
托管组件
(),您可以只列出执行者的bean NEMA。
您的
queueChannel
将不会成为代理。

John,我想我们已经在您的另一个问题的聊天中讨论了这一点。你还需要帮助吗?非常感谢Gary。谢谢Artem,但我想获得QueueChannel实例,以便获得剩余容量。我明天去看看。不管怎样,我是用加里的方法工作的。
java.lang.IllegalStateException: Cannot convert value of type 
[$Proxy336 implementing org.springframework.integration.core.PollableChannel,  
org.springframework.integration.MessageChannel] to required type  
[org.springframework.integration.channel.QueueChannel] 
for property 'channel': no matching editors or conversion strategy found