这篇文章主要讲解了“SpringBoot集成RocketMQ报错:Bad annotation definition in @ExtRocketMQTemplateConfiguration的解决方法”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“SpringBoot集成RocketMQ报错:Bad annotation definition in @ExtRocketMQTemplateConfiguration的解决方法”吧!
使用官方提供的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 { }
贴上了堆栈信息:
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] ...
根据报错提示,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的解决方法这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。