码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-05-25 10:09:40      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:http   context   img   factor   添加   org   ack   pos   items   

今天练习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   context   img   factor   添加   org   ack   pos   items   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!