Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed
2017-03-01 00:00
597 查看
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.springmvc.dao.UserDAO cn.springmvc.service.impl.UserServiceImpl.userDAO; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.springmvc.dao.UserDAO] 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)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
解决办法:
在你的service 实现类 impl 方法前加上 @service。
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cn.springmvc.dao.UserDAO cn.springmvc.service.impl.UserServiceImpl.userDAO; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [cn.springmvc.dao.UserDAO] 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)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
解决办法:
在你的service 实现类 impl 方法前加上 @service。
相关文章推荐
- Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed
- Error creating bean with name 'roleServiceImpl': Injection of autowired dependencies failed;
- Error creating bean with name 'adminUserController': Injection of autowired dependencies failed;
- bean依赖注入错误:Error creating bean with name 'itemService': Injection of autowired dependencies failed
- Error creating bean with name '****': Injection of autowired dependencies failed
- Error creating bean with name 'xx': Injection of autowired dependencies failed
- Error creating bean with name 'assetQueryController': Injection of autowired dependencies failed; ne
- Error creating bean with name 'XXX': Injection of autowired dependencies failed解决办法
- Error creating bean with name 'xxxx': Injection of autowired dependencies failed;
- Java-4-解决报错:Error creating bean with name 'globalAppObj': Injection of autowired dependencies failed
- Error creating bean with name '***(类名)': Injection of autowired dependencies failed;
- spring问题:Error creating bean with name 'articleController': Injection of autowired dependencies fail
- rror creating bean with name 'adminController': Injection of autowired dependencies failed;
- Error creating bean with name 'contentTypeAdminController': Injection of autowired dependencies fail
- springMVC项目启动时出现bean注入失败的情况:Error creating bean with name 'XXX': Injection of autowired dependencies
- Error creating bean with name 'sysUserController': Injection of resource dependencies failed; nested
- Error creating bean with name 'userService': Injection of resource methods failed; nested exception is org.springframework.beans
- spring boot 报错 Error creating bean with name 'indexController': Injection of autowired dependencies
- 【SPRINGMVC】Error creating bean with name 'projectController': Injection of autowired dependencies
- Error creating bean with name 'userService': Injection of resource methods failed; nested exception is org.springframework.beans