RocketMQ 用@Autowired无法被注入
RocketMQ 用@Autowired无法被注入
·
RocketMQ 用@Autowired无法被注入
代码如下:
@Autowired
private RocketMQTemplate rocketMQTemplate;
RocketMQ 无法被注入,报错:Consider defining a bean of type ‘org.apache.rocketmq.spring.core.RocketMQTemplate’ in your configuration.
原因是配置文件没有对RocketMQ 进行配置,在yml上面加上配置:
# rocketmq地址
rocketmq:
name-server: 127.0.0.1:9876
# 默认的消息组
producer:
group: test
ip、端口和组名,改为自己的
更多推荐
已为社区贡献5条内容
所有评论(0)