Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.
09-Jul-2018 23:02:37.393 信息 [http-nio-8080-exec-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring FrameworkServlet 'SpringMVC'
09-Jul-2018 23:02:38.319 严重 [http-nio-8080-exec-1] org.apache.catalina.core.ApplicationContext.log StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userLoginController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.search.service.face.UserLoginService com.search.controller.UserLoginController.userLoginService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UserLoginServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.search.dao.face.UserLoginDAO com.search.service.serviceimpl.UserLoginServiceImpl.UserLoginDAO; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.search.dao.face.UserLoginDAO] 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)}
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userLoginDAO' defined in file [D:\Java\ApacheTomcat-9.0.8-windows-x64\apache-tomcat-9.0.8\webapps\ROOT\WEB-INF\classes\com\search\dao\face\UserLoginDAO.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'sessionFactoryBean' defined in file [D:\Java\ApacheTomcat-9.0.8-windows-x64\apache-tomcat-9.0.8\webapps\ROOT\WEB-INF\classes\spring\spring-mybatis.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryBean' defined in file [D:\Java\ApacheTomcat-9.0.8-windows-x64\apache-tomcat-9.0.8\webapps\ROOT\WEB-INF\classes\spring\spring-mybatis.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userLoginDAO' defined in file [D:\Java\ApacheTomcat-9.0.8-windows-x64\apache-tomcat-9.0.8\webapps\ROOT\WEB-INF\classes\com\search\dao\face\UserLoginDAO.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory': : Error creating bean with name 'sessionFactoryBean' defined in file [D:\Java\ApacheTomcat-9.0.8-windows-x64\apache-tomcat-9.0.8\webapps\ROOT\WEB-INF\classes\spring\spring-mybatis.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactoryBean' defined in file [D:\Java\ApacheTomcat-9.0.8-windows-x64\apache-tomcat-9.0.8\webapps\ROOT\WEB-INF\classes\spring\spring-mybatis.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(A
utowiredAnnotationBeanPostProcessor.java:334)
业务接口
业务实现层
控制层
简单说**解
1、DAO层注解@Repository
2、Controller层注解@Controller
3、Service层注解@Service
4 @Component组件注解
网上找了很多资料多有
1、web.xml文档的配置不对,
2、 bean配置的不正确或漏掉,
3、@Service注解使用不当的或漏掉
我这个是maven的pom.xml配置的时候少了一些扎包和插件类,造成冲突和依赖不够。
供参考....