标签:文件中 根据 auto util lease anti instant pre yml
使用官方提供的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...
标签:文件中 根据 auto util lease anti instant pre yml
原文地址:https://www.cnblogs.com/HeCG95/p/11784783.html