admin管理员组文章数量:1567285
在服务 AaaService 中注入 BbbService 死活不行。
at org.spring[17:00:35] ERROR (ContextLoader.java:319) - Context initialization failed
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'aaaService': Injection of resource dependencies failed;
nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException:
Bean named 'bbbService' must be of type [com.jerry.service.IBbbService],
but was actually of type [com.sun.proxy.$Proxy232]
奇怪就在这句
must be of type [com.jerry.service.IBbbService], but was actually of type [com.sun.proxy.$Proxy232]
我明明都给对了,你为什么要给我来个 but。
日了狗了。 BbbService 实现的接口写错了。写成了另一个名字很像的接口。
这就等于接口 IBbbService 根本没有实现类。应该就是这个原因注入不了吧。
这个报错的坑就在于我根本不知道这 [com.sun.proxy.$Proxy232]
是个啥。它要是能显示出我写错的那个接口,这个错误应该一眼就能发现了。结果害我瞎忙一下午。
本文标签: 报错typeSpringresourceproxy
版权声明:本文标题:Spring @Resource 注入报错 must be of type [xxx], but was actually of type [com.sun.proxy.$Proxy###] 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1726602739a1077229.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论