今天调试项目代码,出现的引resource的报错,查原因查了好长时间才找到,现在这里总结一下,以免以后忘掉以及给大家参考。

报错大致内容入下:

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

 找不到依赖的dao,什么原因,spring3 自动注解的,为什么找不到?

找了很多资料,常见的有下面这个:

1、beans 的xml里面没有配置 
<context:component-scan base-package="package-name"/>

2、第二种情况(调用死循环)

很遗憾,我的不是这个问题,我的问题是dao的调用出现死循环,即XyyyyDao实现里面,调用了他接口的本身方法:

@Repository
public class ADaoImpl extends BaseDaoImpl implements ADao { @Resource
private ADao aDao; @Override
public int addInbox(TInbox inbox) {
....
......
aDao.delete(id);
}
@Override
public int delete(Long id) {
.....
}
}

导致,加载ADaoImpl需要先加载完ADao,而ADao却还没有加载!

Injection of resource dependencies failed解决办法总结的更多相关文章

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

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

  2. Error creating bean with name 'testController': Injection of resource dependencies failed;

    启动ssm项目报错: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 't ...

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

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

  4. Java报错:Injection of resource dependencies failed

    在学习springMVC+Mabatis的时候,添加注解@Resource报错 Injection of resource dependencies failed de完bug后发现有几个点注意一下, ...

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

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

  6. 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 ...

  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. 异常:Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException

    这个异常是出现在注入配置文件中配置好的属性时报错的: Injection of autowired dependencies failed; nested exception is java.lang ...

  9. Injection of autowired dependencies failed

    error:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mainCo ...

随机推荐

  1. 03 Java 虚拟机是如何加载 Java 类的

    Java 引用类型 Java 中的引用类型细分为四种:类,接口,数组类和泛型参数. 因为泛型参数会在编译过程中被擦除,所以 Java 虚拟机实际上只有前三种.数组类是由 Java 虚拟机直接生成的,其 ...

  2. LeetCode 62 不同路径

    一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” ).机器人每次只能向下或者向右移动一步.机器人试图达到网格的右下角.问总共有多少条不同的路径? 示例 1: 输入: ...

  3. [SCOI2011][bzoj2331] 地板 [插头dp]

    题面: 传送门 思路: 插头dp基础教程 这个L形......第一眼看上去真的是丧病啊 但是仔细想想,实际上也就是拿一堆路径铺满一个棋盘,这个路径还是有限制的 那还有什么好说的,插头dp上啊[雾] 首 ...

  4. 关于ContextImp的源码分析

      关于ContextImp的源码分析 来源: http://blog.csdn.net/qinjuning/article/details/7310620 Context概述:   Android ...

  5. PE508

    真是日了苟了我之前还以为那个递归会炸状态..我真他妈胆小啊.. = = 明确一下,这个可以构成所有高斯整数(唯一),构造方法大概就是先看曼哈顿距离,然后判断要不要减1,然后再/(1-i) 我们考虑在末 ...

  6. ip地址正则表达式

    p = re.compile('^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$') if p.match(dom ...

  7. CF 148D Bag of mice【概率DP】

    D. Bag of mice time limit per test 2 seconds memory limit per test 256 megabytes Promblem descriptio ...

  8. 在LINQ TO SQL 中使用MVC3中的DataAnnotations 【MetadataType】

    原文发布时间为:2011-04-07 -- 来源于本人的百度文章 [由搬家工具导入] http://stackoverflow.com/questions/1535662/asp-net-mvc-li ...

  9. android中与Adapter相关的控件----Spinner&AutoCompleteTextView

    Spinner(列表选项框) & AutoCompleteTextView(自动完成文本框) 一.列表选项框核心属性 android:dropDownHorizontalOffset设置列表框 ...

  10. javascript实现复选框的全选全不选

    通过复选框的id获取到复选框 元素 对复选框绑定点击事件 每个checkbox都设置相同的name checkOne 通过得到的元素获取checkbox的状态 当点击全选全不选checkbox时,检查 ...