Controller层 错误提示:Could not autowire. No beans of ‘StudentService’ type found
原因一:可能是你的Spring.xml配置文件里面自动扫描包的位置出错了
如图,把自动扫描的位置固定在controller里面了,所以扫描不到其他的文件,应把路径范围扩大
原因二:service层的实现类没有加@Service

本文探讨Controller层出现“Couldnotautowire.Nobeansof‘StudentService’typefound”错误的原因及解决办法,主要涉及Spring配置文件扫描路径设置不当与service层实现类未正确标注的问题。
Controller层 错误提示:Could not autowire. No beans of ‘StudentService’ type found
原因一:可能是你的Spring.xml配置文件里面自动扫描包的位置出错了
如图,把自动扫描的位置固定在controller里面了,所以扫描不到其他的文件,应把路径范围扩大
原因二:service层的实现类没有加@Service

4661
11万+

被折叠的 条评论
为什么被折叠?
