SpringBoot集成RocketMQ报错:Badannotationdefinitionin@ExtRocketMQTemplateConfiguration的解决方法
这篇文章主要讲解了“SpringBoot集成RocketMQ报错:Bad annotation definition in @ExtRocketMQTemplateConfiguration的解决方法”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“SpringBoot集成RocketMQ报错:Bad annotation definition in @ExtRocketMQTemplateConfiguration的解决方法”吧!
创新互联是一家专业提供江华企业网站建设,专注与成都做网站、网站建设、H5响应式网站、小程序制作等业务。10年已为江华众多企业、政府机构等服务。创新互联专业的建站公司优惠进行中。
1.问题缘由
使用官方提供的rocketmq-spring-boot-starter
提供的例子写ExtRocketMQTemplate
时候,修改了配置文件中的nameServer
配置,改成了和rocketmq.name-server
一样的值:
## 配置文件 rocketmq: name-server: 192.168.2.182:9876;192.168.2.183:9876 ... demo: rocketmq: ... extNameServer: 192.168.2.182:9876;192.168.2.183:9876 ## Java Code @ExtRocketMQTemplateConfiguration(nameServer = "${demo.rocketmq.extNameServer}") public class ExtRocketMQTemplate extends RocketMQTemplate { }
2.问题描述
贴上了堆栈信息:
org.springframework.beans.factory.support.BeanDefinitionValidationException: Bad annotation definition in @ExtRocketMQTemplateConfiguration, nameServer property is same with global property, please use the default RocketMQTemplate! at org.apache.rocketmq.spring.autoconfigure.ExtProducerResetConfiguration.validate(ExtProducerResetConfiguration.java:153) ~[rocketmq-spring-boot-2.0.3.jar:2.0.3] at org.apache.rocketmq.spring.autoconfigure.ExtProducerResetConfiguration.registerTemplate(ExtProducerResetConfiguration.java:88) ~[rocketmq-spring-boot-2.0.3.jar:2.0.3] at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[na:1.8.0_144] at org.apache.rocketmq.spring.autoconfigure.ExtProducerResetConfiguration.afterSingletonsInstantiated(ExtProducerResetConfiguration.java:75) ~[rocketmq-spring-boot-2.0.3.jar:2.0.3] ...
3.问题解决
根据报错提示,nameServer
不能设置为和上面rocketmq.name-server
一样的值,改为不一样即可解此问题:
rocketmq: name-server: 192.168.2.182:9876;192.168.2.183:9876 ... # properties used in the application demo: rocketmq: ... extNameServer: 192.168.2.182:9876
感谢各位的阅读,以上就是“SpringBoot集成RocketMQ报错:Bad annotation definition in @ExtRocketMQTemplateConfiguration的解决方法”的内容了,经过本文的学习后,相信大家对SpringBoot集成RocketMQ报错:Bad annotation definition in @ExtRocketMQTemplateConfiguration的解决方法这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!
文章名称:SpringBoot集成RocketMQ报错:Badannotationdefinitionin@ExtRocketMQTemplateConfiguration的解决方法
文章分享:http://ybzwz.com/article/pidhdj.html