zuidaima8181的gravatar头像
zuidaima8181 2018-05-08 17:08:58
SSM项目中@org.springframework.beans.factory.annotation.Autowired(required=true) 解决方法

今天做项目时突然就出现了这个错误

SSM项目中@org.springframework.beans.factory.annotation.Autowired(required=true) 解决方法

异常错误原因  创建paymentOrdercontroller bean失败

出现这个错误时,首先先去Spring mvc.xml中有没有

<context:component-scan base-package="com.XXX.service"/>

<context:component-scan base-package="com.xxx.web"/>

<context:component-scan base-package="com.xxx.dao"/>

 

 

 

这三个配置  没有的话 就复制进去 改成自己的包名

如果有这三个配置还报错的话

注意了!!!!

就去你的ServiceImpl类 看上面有没有加

@Service 这个注解

通过这个错误总结发现 :写代码 一定要 细心 细心 再细心!!!


打赏
最近浏览
yangbo123  LV1 2022年4月2日
cy_小阳阳  LV2 2022年3月26日
panchunwen  LV1 2021年12月12日
leaving 2021年10月22日
暂无贡献等级
我爱搬砖  LV2 2021年9月14日
wzj520  LV1 2021年8月26日
嬴羸家立 2021年8月12日
暂无贡献等级
lhx13219511309 2021年7月9日
暂无贡献等级
乌龟吃煎蛋  LV1 2021年6月3日
hekaiyun 2021年5月17日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友