您的位置:首页 > 编程语言 > Java开发

bug解决_{@org.springframework.beans.factory.annotation.Autowired(required=true)}

2017-11-27 21:08 567 查看

问题:

org.springframework.beans.factory.BeanCreationException:

Error creating bean with name 'itemsController':

Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:

Could not autowire field: private com.itheima.springmvc.service.ItemsService com.itheima.springmvc.controller.ItemsController.itemsService;

nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:

No qualifying bean of type [com.itheima.springmvc.service.ItemsService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:

{@org.springframework.beans.factory.annotation.Autowired(required=true)}

原因:没有加载spring核心配置文件

解决:在web.xml里面添加applicationContext.xml相关配置就解决了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  bug异常处理
相关文章推荐