【dubbo框架】Injection of resource dependencies failed问题解决

本文解析了一次在Spring Boot项目中遇到的Dubbo服务注入失败的问题,详细介绍了从最初的错误信息分析到最后解决方案的过程。作者最初使用了@Resource注解尝试注入Dubbo服务,但发现服务并未正确加载。通过深入错误信息,最终确定问题根源在于需要使用@Reference注解来正确引用Dubbo服务,从而解决了服务无法注入的问题。

报错信息截图如下:
在这里插入图片描述
报错信息:Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:

一看报错信息就是很明显的bean找不到了,但是看注解什么的都加上了,是为啥导致找不到呢?
后面看了下报错信息,提示了:在这里插入图片描述
原来我引用service的注解还是用的传统的@Resource注解,在注入的时候dubbo服务没有注入,dubbo服务需要用@Reference进行注解。换成@Reference之后就可以启动了。

15:02:17.751 [restartedMain] ERROR o.s.b.SpringApplication - [reportFailure,854] - Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'captureController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'captureService' defined in file [D:\项目\V1.0版本\后端源码\zkzx-lcjl\ruoyi-admin\target\classes\com\ruoyi\web\controller\capture\CaptureService.class]: Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:332) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) at org.s
07-04
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值