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