springboot集成rocketmq启动报错:
APPLICATION FAILED TO START
Description:
A component required a bean of type 'org.apache.rocketmq.spring.core.RocketMQTemplate' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'rocketMQTemplate' in 'RocketMQAutoConfiguration' not loaded because @ConditionalOnBean (types: org.apache.rocketmq.client.producer.DefaultMQProducer; SearchStrategy: all) did not find any beans of type org.apache.rocketmq.client.producer.DefaultMQProducer
Action:
Consider revisiting the entries above or defining a bean of type 'org.apache.rocketmq.spring.core.RocketMQTemplate' in your configuration.
Process finished with exit code 1
springboot用的是2.2.5的版本,rocketmq使用的是4.9.1.的版本:
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>4.9.1</version>
</dependency>
请问谁知道是怎么回事?这是版本不兼容么?
Bean method 'rocketMQTemplate' in 'RocketMQAutoConfiguration' not loaded because @ConditionalOnBean (types: org.apache.rocketmq.client.producer.DefaultMQProducer; SearchStrategy: all) did not find any beans of type org.apache.rocketmq.client.producer.DefaultMQProducer
翻译过来就好了
已经解决了,解决方法是:
rocketmq-spring-boot-starter 2.2.0(不含)以下版本,在项目的application.properties中配置是这样的:
#rocketmq相关配置
spring.rocketmq.nameServer=RocketMq服务IP地址:9876
spring.rocketmq.producer.group=组id
rocketmq-spring-boot-starter 2.2.0及其以上版本,配置是这样的:
#rocketmq相关配置
rocketmq.nameServer=RocketMq服务IP地址:9876
rocketmq.producer.group=组id