admin管理员组文章数量:1566367
在用ssm做项目时,出现了如下错误:
Error creating bean with name 'supplierAction':
Injection of resource dependencies failed;
nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException:
Bean named 'supplierService' must be of type [cn.zua.scm.service.SupplierService],
but was actually of type [com.sun.proxy.$Proxy31]
找了两个多小时,也在网上查了很多资料,最后发现是自己的Service实现类继承错了接口,
应该是:public class SupplierServiceImpl implements SupplierService
却粗心的写成了:public class SupplierServiceImpl implements SupplierMapper。
另外,新手一定要注意注解的名字和类型名是否一致,否则spring也会注入失败:
例如:
注解名是supplierService
@Service("supplierService")
public class SupplierServiceImpl implements SupplierService
但是注入的时候却用的service
@Resource
private SupplierService service;
应该是:
@Resource
private SupplierService supplierService;
版权声明:本文标题:must be of type XXX but was actually of type [com.sun.proxy.$Proxy31] 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1726602645a1077218.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论