Context initialization failed

xiaoxiao2021-02-28  56

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注释。

转载请注明原文地址: https://www.6miu.com/read-72793.html

最新回复(0)