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

来源:互联网 发布:卖淘宝号会泄漏信息吗 编辑:程序博客网 时间:2024/05/20 14:24

问题:

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相关配置就解决了

阅读全文
0 0