1. cause problems
Using official of rocketmq-spring-boot-starter
the examples provided write ExtRocketMQTemplate
, edit the configuration file nameServer
configuration changed and rocketmq.name-server
the same values:
## 配置文件
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. Description of the problem
Paste the stack information:
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. Problem Solving
According to error prompt, nameServer
can not be set above rocketmq.name-server
the value of the same, can be changed to a different solution to this problem:
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