springboot, rocketmq 集成后启动报错Bean method 'rocketMQTemplate' in 'RocketMQAutoConfiguration' not loaded because AnyNestedCondition 0 matched 2 did not
错误日志
Field rocketMQTemplate in com.invech.kitty.rocketmq.producer.xxxx required a bean of type 'org.apache.rocketmq.spring.core.RocketMQTemplate' that could not be found.
\- Bean method 'rocketMQTemplate' in 'RocketMQAutoConfiguration' not loaded because AnyNestedCondition 0 matched 2 did not; NestedCondition on RocketMQAutoConfiguration.ProducerOrConsumerPropertyCondition.DefaultLitePullConsumerExistsCondition @ConditionalOnBean (types: org.apache.rocketmq.client.consumer.DefaultLitePullConsumer; SearchStrategy: all) did not find any beans of type org.apache.rocketmq.client.consumer.DefaultLitePullConsumer; NestedCondition on RocketMQAutoConfiguration.ProducerOrConsumerPropertyCondition.DefaultMQProducerExistsCondition @ConditionalOnBean (types: org.apache.rocketmq.client.producer.DefaultMQProducer; SearchStrategy: all) did not find any beans of type org.apache.rocketmq.client.producer.DefaultMQProducer
原因:
最后一句:
did not find any beans of type org.apache.rocketmq.client.producer.DefaultMQProducer
解决:
配置示例:
是因为
rocketmq.producer.group=my-producer-group没有配置 ,如下:
# application.yml 示例
rocketmq:
name-server: 127.0.0.1:9876 # RocketMQ nameserver 地址
producer:
group: my-producer-group # [生产者组名]是客户端自定义的,无需在 RocketMQ 服务端预先配置
send-message-timeout: 3000 # 发送超时时间(毫秒)
**保证 正确配置 producer.group
- 命名规则
- 推荐格式:
业务名 + "-producer-group"(如order-service-producer-group)。 - 避免特殊字符(如
#,:,/),建议只使用字母、数字和-。
- 推荐格式:
- 不同业务使用不同的
group- 例如:
- 订单服务:
order-producer-group - 支付服务:
payment-producer-group
- 订单服务:
- 避免多个业务共用一个
group,否则可能导致事务消息混乱。
- 例如:

浙公网安备 33010602011771号