为什么找不到引用的 bean null通道?



我通常会收到有关STSProblems视图中未定义 nullChannel 的警告:

Referenced bean 'nullChannel' not found

但是如果我在上下文文件中添加一个声明,例如<int:channel id="nullChannel" /><int:publish-subscribe-channel id="nullChannel">,我会得到一个:

java.lang.IllegalStateException: The bean name 'nullChannel' is reserved.

我想这是一个我可以安全地忽略的警告,但我通常会尝试将警告归零,所以我错过了什么吗?


更新

这些是与警告有关的部分,删除它们会使其消失:

<int:header-value-router input-channel="listOfMaps" header-name="transaction_type" resolution-required="false" default-output-channel="nullChannel">
<int:mapping value="52" channel="requests52ListOfMaps"/>
</int:header-value-router>
<int:service-activator input-channel="httpRequestsSendsChannel" output-channel="nullChannel" ref="conversionController" method="enable52Delivery" />
<int:service-activator input-channel="httpRequestsDeletesChannel" output-channel="nullChannel" ref="inspector" method="inspect" />

我不确定为什么上周对我来说没问题(可能是飞行员错误),但现在我明白了

<int:service-activator input-channel="errorChannel" output-channel="nullChannel" expression="foo" />

而且,如果我翻转输入/输出通道,警告将变为errorChannel- 我们没有收到输入通道警告的原因是因为 STS 大概知道我们将在需要时动态创建输入通道。

我猜STS只是不知道这些隐含的豆子。

我会问STS的人,我们是否可以想出一种方法来给他们一个隐式的bean列表来抑制这些警告。

如果这是不可能的,我们可以考虑放宽规则,防止添加自定义nullChannelbean。

最新更新