org.springframework.beans.factory.NoSuchBeanDefinitionException
1. 问题描述
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxxxxx': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.xx.common.localcache.GuavaCacheManager] 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=)}
如果你在代码中用到jar中的类, 如
@Resource
private GuavaCacheManager guavaCacheManager;
2.解决方法
很显然 这个GuavaCacheManager无法被spring注入 因为并没有纳入spring管理,就是没有使用<bean id="xxx">或者@Service、@Compent扫描注入
所以需要 new一下。
如果jar中有spring配置文件,如jar根目录下有/spring/a.xml
那么 在web.xml中把这个xml扫描就行了
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:/applicationContext.xml,
classpath*:/spring/*.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
org.springframework.beans.factory.NoSuchBeanDefinitionException的更多相关文章
- nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException
You should autowire interface AbstractManager instead of class MailManager. If you have different im ...
- Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException
1.错误描写叙述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -he ...
- 添加事务后 org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type available
今天遇到了一个奇怪的问题 在没添加事务之前 所有的代码都是好的 , 当我添加了事务之后, 代码报错 org.springframework.beans.factory.NoSuchBeanDef ...
- org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager'
1.错误描述 五月 01, 2015 2:12:31 下午 org.hibernate.validator.util.Version <clinit> 信息: Hibernate Vali ...
- spring Boot异步操作报错误: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.self.spring.springboot.Jeep' available
我也是最近开始学习Spring Boot,在执行异步操作的时候总是汇报如下的错误: Exception in thread "main" org.springframework.b ...
- Caused by:org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type "" available: expected at least 1 bean which qualifies as autowire candidate
项目使用spring, mybatis.因为分了多个模块,所以会这个模块引用了其它模块的现在,结果使用Junit测试的时候发现有两个模块不能自动注入dao和service问题.解决后在此记录一下. 解 ...
- Spring Boot 调用 MongoRepository时报org.springframework.beans.factory.NoSuchBeanDefinitionException错误的解决办法
这个问题整整折腾了我两天,现在记录下来,希望可以帮助和我一样,遇到相同问题的小伙伴. 项目是分层的(Intellij IDEA中的模块Module),有API(Core)层,Service&D ...
- Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException
今天在学习spring 框架的时候看着,很简单.但是在真正开始做的时候发现,异常一个接着一个,整的肚子都被搞大了. Exception in thread "main" org.s ...
- 解决org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cacheManager' is defined
在Spring配置文件中加入了支持注解,即<mvc:annotation-driven/> 重新启动服务器包 org.springframework.beans.factory.NoSuc ...
- org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'testService' is defined
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'testService' is defi ...
随机推荐
- PyQt5(4)——菜单栏(使用外部exe)
图像化建立菜单栏: ① 双击输入名称 就可以喽 如何添加工具栏呢: 新建一个快捷工具,拖到快捷栏,出现红色的小竖线. 至此 就完成了菜单栏和快捷方式的建立. 补充: python 如何调用外部的e ...
- 2016级算法第五次上机-D.AlvinZH的学霸养成记III
850 AlvinZH的学霸养成记III 思路 难题.概率DP. 第一种思考方式:直接DP dp[i]:从已经有i个学霸到所有人变成学霸的期望. 那么答案为dp[1],需要从后往前逆推.对于某一天,有 ...
- JavaScript的深拷贝和浅拷贝
一.数据类型 数据分为基本数据类型(String, Number, Boolean, Null, Undefined,Symbol)和对象数据类型.. 1.基本数据类型的特点:直接存储在栈(stack ...
- windows下webpack不是内部命令 解决方法
安装webpack 到打包文件一路出现的各种问题 windows下webpack不是内部命令 安装完webpack后要加下环境变量 系统变量新建 NODE_PATH 变量值E:\demo\webpac ...
- python学习,day3:示例,进度条
# coding=utf-8 # Author: RyAn Bi import sys,time for i in range(50): sys.stdout.write("#") ...
- 3. Javascript学习笔记——变量、内存、作用域
3. 变量.内存.作用域 3.1 基本类型和引用类型的值 ECMAScript 变量可能包含两种不同数据类型的值:基本类型值[Undefined.Null.Boolean.Number 和 Strin ...
- mvn修改版本号命令
mvn -DnewVersion=1.0.0 -DgenerateBackupPoms=false versions:set
- 通过遍历类向Aspose.cell模板中插入数据
/// <summary> /// 遍历类所有字段 /// </summary> /// <param name="designer">aspo ...
- Ubuntu禁用Compiz
环境: Ubuntu 16.04 什么是Compiz: https://zh.wikipedia.org/wiki/Compiz ,简单理解是实现了Ubuntu的3D效果 禁用的好处: 节省内存和CP ...
- python3.5+ asyncio await异步详解
import asyncio,time from collections import defaultdict from pprint import pprint collect=defaultdic ...