首页 > 其他 > 详细

SSM框架整合错误:Could not autowire field

时间:2020-07-10 01:07:34      阅读:90      评论:0      收藏:0      [点我收藏+]

debug信息:

spring整合mybatis错误:Could not autowire field: com.zy.ssm.service.BookService com.zy.ssm.contr...

分析:
可以清晰的看出是Could not autowire field错误,错误原因是:com.zy.ssm.service.BookService这个类无法自动装配,位于
Error creating bean with name ‘bookService‘此处

无法自动装配一般是spring配置文件未配置扫描,查看spring-dao.xml文件:

解决1:

发现未扫描impl包,所以加上<context:component-scan base-package="your package location" />对应的包地址就行了,注意替换成你自己的包地址

技术分享图片

 解决2:

检查@controller,@Service等注释写了没

 

问题2:

技术分享图片

 

 

 

 

 

 

 

技术分享图片

 

 

 

解决:这两处不要同名

 

SSM框架整合错误:Could not autowire field

原文:https://www.cnblogs.com/yangmie/p/13277107.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!