SpringBoot项目改SpringCloud项目,没集成alibaba nacos时运行无异常,集成了之后启动报错,提示找不到相关bean,但是功能却是正常的。 云配置文件是加载到了的 报错内容:
2019-11-14 15:31:28 [ com.alibaba.nacos.client.Worker.longPullingacm.aliyun.com-32f1587d-47d1-4060-bf86-870b0d47c500:17212 ] - [ WARN ] org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:558) Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'invoiceCallbackApiController': Unsatisfied dependency expressed through field 'invoiceCallbackProducer'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'yongYouInvoiceCallbackProducer': Unsatisfied dependency expressed through field 'amqpTemplate'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.amqp.core.AmqpTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2019-11-14 15:31:28 [ com.alibaba.nacos.client.Worker.longPullingacm.aliyun.com-32f1587d-47d1-4060-bf86-870b0d47c500:17220 ] - [ ERROR ] org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter.report(LoggingFailureAnalysisReporter.java:42)
***************************
APPLICATION FAILED TO START
***************************
Description:
Field amqpTemplate in cn.xxx.invoice.service.rabbitmq.producer.YongYouInvoiceCallbackProducer required a bean of type 'org.springframework.amqp.core.AmqpTemplate' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.amqp.core.AmqpTemplate' in your configuration.
遇到了同样的问题,在CSDN看到了,希望阿里云团队能够给出正确、标准的答案~请查看
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。