apache / rocketmq-spring

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

@ConditionalOnBean (types: org.apache.rocketmq.client.producer.DefaultMQProducer; SearchStrategy: all) #157

Open D-Saber opened 5 years ago

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.

Originally posted by @D-Saber in https://github.com/apache/rocketmq-spring/issues/98#issuecomment-541546842

RongtongJin commented 4 years ago

Have you configured items about rocketmq.name-server & rocketmq.producer.group in your application?

afeicool commented 4 years ago

same issue:

apollo config:

rocketmq.nameServer=http\://onsaddr.mq-internet-access.mq-internet.aliyuncs.com\:80 rocketmq.producer.group=GID_xxxx


error mssage:

Action:

Consider revisiting the entries above or defining a bean of type 'org.apache.rocketmq.spring.core.RocketMQTemplate' in your configuration.

2019-11-14 14:04:28,215 [main] ERROR org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter -


APPLICATION FAILED TO START


Description:

Parameter 0 of constructor in com.vphoto.ai.image.core.controller.TagsDetectController 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:

Action:

Consider revisiting the entries above or defining a bean of type 'org.apache.rocketmq.spring.core.RocketMQTemplate' in your configuration.

afeicool commented 4 years ago

after some research 俺解决了:

启动时候或在application.properties里加这个: apollo.bootstrap.enabled = true

https://github.com/ctripcorp/apollo/wiki/Java%E5%AE%A2%E6%88%B7%E7%AB%AF%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97#3213-spring-boot%E9%9B%86%E6%88%90%E6%96%B9%E5%BC%8F%E6%8E%A8%E8%8D%90

D-Saber commented 4 years ago

after some research 俺解决了:

启动时候或在application.properties里加这个: apollo.bootstrap.enabled = true

https://github.com/ctripcorp/apollo/wiki/Java%E5%AE%A2%E6%88%B7%E7%AB%AF%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97#3213-spring-boot%E9%9B%86%E6%88%90%E6%96%B9%E5%BC%8F%E6%8E%A8%E8%8D%90

不是的,使用bootstrap阶段注入是没有问题,但是如果项目中springboot对rocketmq-spring进行封装打成组件jar,封装例如:(做一些契合业务的日志发送记录,API约定等等..), 其他业务服务引用此jar是必须配置rocketmq.producer.group的,但是我子消费服务引用此组件时,并不需要使用这个配置。因为这个属于生产组配置。