启动ssm项目报错:

org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'testController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.test.www.web.service.user.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)} Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [com.test.www.web.service.user.UserService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}

检查配置spring的配置文件里面的自动扫描配置、mybatis与spring整合配置、事务aop配置中的路径是否正确:

<!-- 自动扫描包 ,将带有注解的类 纳入spring容器管理 -->
<context:component-scan base-package="com.test.www"></context:component-scan>
<!-- mybatis文件配置,扫描所有mapper文件 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean" p:dataSource-ref="dataSource"
p:configLocation="/WEB-INF/conf/mybatis-config.xml"
p:mapperLocations="classpath*:com/test/www/web/dao/*.xml"/> <!-- spring与mybatis整合配置,扫描所有dao -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer" p:basePackage="com.test.www.web.dao"
p:sqlSessionFactoryBeanName="sqlSessionFactory"/>
<!-- 事务 aop 配置 -->
<aop:config>
<aop:pointcut id="serviceMethods" expression="execution(* com.test.www.web.service..*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethods"/>
</aop:config>

No qualifying bean of type [com.test.www.web.service.user.UserService] found for dependency:

以及contorller和serviceimp中的是否添加了正确的注解:
@Controller、@Service

Error creating bean with name 'testController': Injection of resource dependencies failed;的更多相关文章

  1. Java报错:Error creating bean with name 'testController': Injection of resource dependencies failed

    报错如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testCo ...

  2. 【解决方案】 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userHandler': Injection of resource dependencies failed;

    一个错误会浪费好多青春绳命 鉴于此,为了不让大家也走弯路,分享解决方案. [错误代码提示] StandardWrapper.Throwableorg.springframework.beans.fac ...

  3. Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fundService': Injection of resource dependencies failed;

    在进行SSM的Controller的编写, 从浏览器访问后端Controller的时候遇到了这个问题. 这个问题的描述: 创建Bean的对象失败 错误代码如下: @Service("fund ...

  4. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'supplierAction': Injection of resource dependencies failed; nested exception is org.springframework.beans.factor

    这个错误是因为抽象Action类的时候,把ServletContext写成了serverContext,导致无法注入,正确写法是 import javax.annotation.Resource; i ...

  5. eclipse 启动tomcat报Spring错误 Error creating bean with name 'serviceOrderBiz': Injection of autowired dependencies failed

    启动tomcat报异常,提示Sring无法创建serviceOrderBiz(第一行红字),继续看是因为有一个自动注入的字段无法注入ModuleInterfaceBiz(第二行红字),检查servic ...

  6. Error creating bean with name 'signController': Injection of autowired dependencies failed

    出现了一大串错误,Error creating bean with name 'signController': Injection of autowired dependencies failed. ...

  7. Failed to load ApplicationContext ,Error creating bean with name 'adminUserService': Injection of autowired dependencies failed;

    Druid配置的时候出现这个问题: "C:\Program Files\Java\jdk1.8.0_191\bin\java" -ea -Didea.test.cyclic.buf ...

  8. Error creating bean with name 'adminUserController': Injection of autowired dependencies failed;

    spring 个坑爹地,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ...

  9. Error creating bean with name 'contentCategoryController': Injection of autowired dependencies failed;

    在springmvc.spring.mybatis搭建的工程中出现了一大串错误 查了代码后发现,原来是在ContentCategoryServiceImpl中忘了写一句话@Service(),以至于因 ...

随机推荐

  1. linux下通过命令启动多个终端运行对应的命令和程序

        作者:张昌昌 在一些情况下,往往须要同一时候启动多个终端并让终端运行自己主动运行对应的命令,进而达到提高操作效率的目的.在linux下gnome-terminal启动终端命令, gnome-t ...

  2. 【Oracle学习笔记】

    内容主要包括: (1)三种循环及其简化 (2)游标的使用 (3)异常处理 (4)存储过程 (5)存储函数 (6)触发器 (7)其它pl/sql操作 ---------------loop循环定义变量- ...

  3. Ubuntu: GlusterFS+HBase安装教程

    HBase通常安装在Hadoop HDFS上,但也能够安装在其它实现了Hadoop文件接口的分布式文件系统上.如KFS. glusterfs是一个集群文件系统可扩展到几peta-bytes. 它集合了 ...

  4. Android 启动界面的制作

    直接看实例吧 package com.example.textview; import android.app.Activity; import android.content.Intent; imp ...

  5. Android应用内加载pdf的方法?

    [可行] 最直接的方式下载到本地, 然后调用相关应用打开 [可行,有局限] 使用 webview 加载, 需要在 原url 前面加上 http://docs.google.com/gview?url= ...

  6. bzoj5157: [Tjoi2014]上升子序列(树状数组LIS)

    5157: [Tjoi2014]上升子序列 题目:传送门 题解: 学一下nlogn的树状数组求最长上生子序列就ok(%爆大佬) 离散化之后,用一个数组记录一下,直接树状数组做 吐槽:妈耶...一开始不 ...

  7. POJ 2190 模拟

    按照题意模拟就好- 注意"X"只能出现在最后一位... // by SiriusRen #include <cstdio> using namespace std; c ...

  8. vim编辑器常用语法

    1)yy (功能描述:复制光标当前一行) y数字y (功能描述:复制一段(从第几行到第几行))2)p (功能描述:箭头移动到目的行粘贴)3)u (功能描述:撤销上一步)4)dd (功能描述:删除光标当 ...

  9. 【摘录】JDBC Master Slave(JDBC方式的JMS集群)

    JDBC Master Slave First supported in ActiveMQ version 4.1 If you are using pure JDBC and not using t ...

  10. 【原创】VMWare克隆或复制Linux虚拟机后无法上网的解决

    如果选择桥接,需要设置网卡通过哪个物理网卡桥接,桥接代表当前虚拟机通过本机的网卡直接连到网络中,本机网卡作为一个交换机直连.因此需要确定使用哪个网卡桥接,一般在单网卡的时候选择自动即可,多网卡时需要指 ...