首页 > 其他 > 详细

使用<context:component-scan base-package="" ></context:component-scan>报500错误

时间:2017-05-25 09:21:16      阅读:462      评论:0      收藏:0      [点我收藏+]

今天练习SSH小程序,在springmvc.xml中使用<context:component-scan base-package="" ></context:component-scan> 组件扫描controller的时候,一直报500错误,在网上查了很久没有解决。错误如下

技术分享

 

 于是便将其注释掉,使用<bean class=""></bean>使用bean来一个个添加。。500错误没有了,但是来了个空指针异常。我打印输出了service对象值

技术分享

难道是itemsService没有注入成功?于是我spring.xml中加入代码<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>问题才解决。。但是我在看视频教程的时候,老师使用<context:component-scan 后并没有使用<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>。。所以怎样解决我这种使用<context:component-scan base-package="" ></context:component-scan>报500错误啊  ~~~~(>_<)~~~~????

使用<context:component-scan base-package="" ></context:component-scan>报500错误

原文:http://www.cnblogs.com/zl120439073/p/6901929.html

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