spring-boot-starter-parent
org.springframework.boot spring-boot-starter-parent 2.1.3.RELEASE
rocketmq的maven依赖
org.apache.rocketmq rocketmq-spring-boot-starter 2.2.0
org.apache.rocketmq rocketmq-client 4.8.0 报错提示
2021-02-14 21:26:32.369 WARN 6356 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userService': Unsatisfied dependency expressed through field 'rocketMQTemplate'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.apache.rocketmq.spring.core.RocketMQTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} 2021-02-14 21:26:32.369 INFO 6356 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2021-02-14 21:26:32.379 INFO 6356 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. 2021-02-14 21:26:32.379 INFO 6356 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 2021-02-14 21:26:32.389 INFO 6356 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2021-02-14 21:26:32.409 INFO 6356 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2021-02-14 21:26:32.529 ERROR 6356 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
Field rocketMQTemplate in com.tanhua.sso.service.UserService required a bean of type 'org.apache.rocketmq.spring.core.RocketMQTemplate' that could not be found.
The injection point has the following annotations: - @org.springframework.beans.factory.annotation.Autowired(required=true)
The following candidates were found but could not be injected: - 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
Action:
Consider revisiting the entries above or defining a bean of type 'org.apache.rocketmq.spring.core.RocketMQTemplate' in your configuration.
并且提问,rocketmq与redis是否有版本冲突或者依赖冲突. redis与rocketmq一起使用导致了redis获取key值需要一分钟左右才能获取到
原提问者GitHub用户Elgin-xj
看上去是 RocketMQTemplate 没有完成配置导致的,可以参考https://github.com/apache/rocketmq-spring/wiki 配置一下,另外rocketmq-spring 跟redis 是没有冲突的
原回答者GitHub用户duhenglucky
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。