Context initialization failed

来源:互联网 发布:centos7查看端口状态 编辑:程序博客网 时间:2024/05/18 02:21
2017-08-07 09:33:31 ERROR [org.springframework.web.servlet.DispatcherServlet] Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deptController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.service.DeptService com.controller.DeptController.deptService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.service.DeptService] 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)}


报错如上说的是首先DispatcherServlet报错说上下文初始化失败,原因是BeanCreationException,也就是创建Bean的时候失败,原因是在创建deptController这个Bean的时候,其所依赖的Bean注入失败。这个Bean就是DeptService,因为我的疏忽没有为这个接口的实现类添加@Service注释。

阅读全文
0 0
原创粉丝点击