@MessagingGateway 无法注入--初次使用Spring integration集成mqtt填坑记录

一、背景

首次使用Spring integration集成mqtt,按照网上的各种指导文档,写完后无法启动,一直报错:

Parameter 0 of constructor in com.xxxx.xxxx required a bean of type 'com.xxxx.xxxx' that could not be found.

Action:
Consider defining a bean of type 'com.xxxx.xxxx' in your configuration.

无法注入的这个是使用 @MessagingGateway注解的一个接口

二、原因:

下载@MessagingGateway的源码,可以看到这样一些注释

大意就是, @MessagingGateway注解需要配合 @IntegrationComponentScan和@Configuration注解使用。@ComponentScan无法扫描到。

吐槽一下,网上写文档的这些大哥,能不能靠谱点,参考了那么多文档,就没一个提到这事的,就算抄,好歹也测试一下啊!!!

评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值