spring mvc注入service报错是什么原因?

部分代码如下:

报错:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private myforum.service.UserTest myforum.controller.UserController.userTest; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [myforum.service.UserTest] 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)}
配置如下:web.xmlcontextConfigLocationclasspath:spring.xml,classpath:spring-hibernate.xmlspring mvc servletspringMvcorg.springframework.web.servlet.DispatcherServletspring mvc 配置文件contextConfigLocationclasspath:spring-mvc.xml1    springMvc*.action  spring.xmlspring-mvc.xml
需要的都提供了  应该没错,就是注入错误。求牛人解答

第1个回答  2017-12-29

    从controller到service到dao全部检查一遍;

    或者全部粘贴出来,才能看到问题。

本回答被网友采纳

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网