apache / rocketmq-spring

Apache RocketMQ Spring Integration
https://rocketmq.apache.org/
Apache License 2.0
2.11k stars 898 forks source link

A component required a bean of type 'org.apache.rocketmq.spring.core.RocketMQTemplate' that could not be found #98

Closed h735004790 closed 4 years ago

h735004790 commented 5 years ago

springboot2.x and rocketmq-spring-boot-starter2.0.3,when 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:

fangjian0423 commented 5 years ago

could you please provide a project that reproduces the issue?

xue2lang commented 5 years ago

@fangjian0423 when project use Apollo configuration center of XieCheng,project will be started failed,the same problem that:A component required a bean of type 'org.apache.rocketmq.spring.core.RocketMQTemplate' that could not be found.

fangjian0423 commented 5 years ago

I think the configuration items about rocketmq.name-server & rocketmq.producer.group is not configured in Apollo, so the RocketMQAutoConfiguration didn't work.

D-Saber commented 5 years ago

I think the configuration items about rocketmq.name-server & rocketmq.producer.group is not configured in Apollo, so the RocketMQAutoConfiguration didn't work.

but after packing rocketmq-spring-boot-starter jar for project then rocketmq.producer.group is must be configured can be used I want to know how his loading order is solved.

higlowx commented 5 years ago

i also encountered this problem.

RongtongJin commented 5 years ago

i also encountered this problem.

As fangjian0423 said, have you configured items about rocketmq.name-server & rocketmq.producer.group?

fangjian0423 commented 5 years ago

Startup with debug mode or see conditions endpoint to find why RocketMQAutoConfiguration didn't work.

vongosling commented 4 years ago

Any update for this issue?

ktios commented 4 years ago

i have added rocketmq.name-server and rocketmq.producer.group, but it still can't work .

qiankun30 commented 4 years ago

解决了吗?

liuxuzxx commented 4 years ago

我也出现了这个问题,版本是2.1.0.后来看了下application.yml配置为

spring:
    rocketmq:
        name-server: xxxxx
        producer:
            group:xxxxxx

看了下RocketMQAutoConfiguration,[笑哭]了,原来配置前缀是prefix="rocketmq"不是prefix="spring.rocketmq" 正确的配置应该是:

spring:
    redis:
        database: 0
        host: localhost
        ........
rocketmq:
  name-server: 172.16.21.138:9876
  producer:
    group: short-message

注意rocketmq和spring同层级

主要是看着datasource,redis,es都是以spring为前缀,也就想当然认为rocketmq也是以spring为大前缀