Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'异常解决方案
悟空非空也
2019-10-14 14:20:02
2014
收藏
3
分类专栏:
SpringMVC
文章标签:
springmvc
版权声明:本文为博主原创文章,遵循
CC 4.0 BY-SA
版权协议,转载请附上原文出处链接和本声明。
本文链接:
https://blog.csdn.net/Java_stud/article/details/102547077
版权
解决方案
分析原因
因为 <mvc:annotation-driven> 有同名的。
错误示范
点赞
7
评论
2
分享
x
海报分享
扫一扫,分享海报
收藏
3
打赏
打赏
悟空非空也
你的鼓励将是我创作的最大动力
C币
余额
2C币
4C币
6C币
10C币
20C币
50C币
确定
举报
关注
关注
一键三连
点赞Mark关注该博主, 随时了解TA的最新博文
已标记关键词
清除标记
Spring报错:
Cannot
resolve
reference
to
bean
'***' while
setting
bean
property
'pointcut'
奋斗鱼
03-13
1万+
Spring报错:
Cannot
resolve
reference
to
bean
‘createOperation’ while
setting
bean
property
‘pointcut’ 在Spring框架中,在做声明式事务测试时,运行报错。中文译为“设置
bean
属性“pointcut”时无法解析对
bean
“createOperation”的引用”。 经过排查,发现是少导入了3个JAR...
插入表情
添加代码片
HTML/XML
objective-c
Ruby
PHP
C
C++
JavaScript
Python
Java
CSS
SQL
其它
还能输入
1000
个字符
相关推荐
Tomcat Jdbc数据源初始化过程以及错误
Cannot
resolve
reference
to
bean
'dataSource' while
setting
bean
property
'da...
maozhuxigood
12-25
1936
今天在做项目的时候,开始一直没有出现问题,后面突然之间出现数据连接数超过某值的问题,因为之前项目使用的数据源是C3P0,上网找了一下关于C3P0的资料,发现很多的人也遇到过同样的问题,这样让我有了改变数据源的想法,通过网上资料对比了现在比较流行的几种数据源,最终我打算使用Tomcat Jdbc数据源。因为Tomcat Jdbc数据源基本和C3P0数据源相同,配置信息也基本相同。并且Jdbc数据源还...
Cannot
resolve
reference
to
bean
'sqlSessionFactory' while
setting
bean
property
'sqlSessionFactory'
qq_16436555的博客
05-11
8218
原因是因为少了cglib-2.2.jar ,而cglig-2.2.jar又引用了asm-2.2.3.jar 所以这两个jar包都需要导入。 重新服务启动之后错误就消失了。
Cannot
resolve
reference
to
bean
'cacheManager' while
setting
bean
property
'cacheManager';
羊咩咩
06-12
2403
异常
信息 Exception encountered during context initialization - cancelling refresh attempt: org.springframework.
bean
s.factory.
Bean
CreationException: Error creating
bean
with name ‘org.springframework.cache...
Cannot
resolve
reference
to
bean
'cacheManager' while
setting
bean
proper
weixin_43342945的博客
12-12
446
ERROR [RMI TCP Connection(2)-127.0.0.1] - Context initialization failed org.springframework.
bean
s.factory.
Bean
CreationException: Error creating
bean
with name 'org.springframework.cache.interceptor.Ca...
解决:
Cannot
resolve
reference
to
bean
‘cacheManager‘ while
setting
bean
property
‘cacheManager‘; ne...
u014545085的博客
07-07
1791
image.png 1. 原因 我这里出现这个原因是因为:我使用idea,自动在springmvc.xml配置文件中,输入<mvc:annotation-driven/> 自动添加xmlns:mvc约束 image.png 有问题呀,明明是mvc,cache是什么鬼 2. 解决办法: 将这几个cache改为mvc就可以啦! ...
Cannot
resolve
reference
to
bean
'sqlSessionFactory' while
setting
bean
property
05-11
原因是因为少了cglib-2.2.jar ,而cglig-2.2.jar又引用了asm-2.2.3.jar 所以这两个jar包都需要导入。 重新服务启动之后错误就消失了。
Cannot
resolve
reference
to
bean
'cacheManager' while
setting
bean
property
'cacheManager
qq_43680223的博客
02-10
88
报这个错误,原因是springmvc.xml文件中的命名空间错误,重新导入即可 错误的为: xmlns:mvc="http://www.springframework.org/schema/cache" 正确的是: xmlns:mvc="http://www.springframework.org/schema/mvc" ...
使用mvc:annotation-driven时遇到的No
bean
named 'cacheManager' is defined问题
qq_37400312的博客
07-17
1799
org.springframework.
bean
s.factory.
Bean
CreationException: Error creating
bean
with name 'org.springframework.cache.interceptor.CacheInterceptor#0':
Cannot
resolve
reference
to
bean
'cacheManager' while
setting
bean
property
'cacheManager'; nested exception
spring容器注入错误总结
Cannot
resolve
reference
to
bean
'***' while
setting
bean
property
'ref'
qq_35250647的博客
03-18
3万+
启动tomcat时如下报错严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.
bean
s.factory.
Bean
CreationException:...
Cannot
resolve
reference
to
bean
'ItemCatService' while
setting
bean
property
'ref'
青苔小榭
01-10
1万+
严重: Exceptionsending context initialized event to listener instance of classorg.springframework.web.context.ContextLoaderListener org.springframework.
bean
s.factory.
Bean
CreationException:Error creatin
关于dubbo的
Cannot
resolve
reference
to
bean
'xxx' while
setting
bean
property
'ref'
weixin_30363981的博客
07-16
348
错误信息:
Cannot
resolve
reference
to
bean
'qJiaServiceImpl' while
setting
bean
property
'ref'; nested exception is org.springframework.
bean
s.factory.NoSuch
Bean
DefinitionException: No
bean
nam...
配置了yml文件但是提示
cannot
resolve
property
XXX
睶
09-26
8518
很多时候我们从网上找了一些配置yml的资源,但会提示
cannot
resolve
property
XXX,导致无法加载相应的资源从而运行错误。 org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key 在这里,我们要思考的问题: 1.相关资源的位置是否写对,即它原本是sping根下的但你另外在其他地方写了...
shrio 配置ehcache 启动报错,一直报cacheManager匹配不对
09-07
ehcache.xml配置: <?xml version="1.0" encoding="UTF-8"?> <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="false" monitoring="autodetect" dynamicConfig="true" name="shiroCache"> <diskStore path="java.io.tmpdir" /> <!-- <diskStore>==========当内存缓存中对象数量超过maxElementsInMemory时,将缓存对象写到磁盘缓存中(需对象实现序列化接口) * <diskStore path="">==用来配置磁盘缓存使用的物理路径,Ehcache磁盘缓存使用的文件后缀名是*.data和*.index * name=================缓存名称,cache的唯一标识(ehcache会把这个cache放到HashMap里) * maxElementsOnDisk====磁盘缓存中最多可以存放的元素数量,0表示无穷大 * maxElementsInMemory==内存缓存中最多可以存放的元素数量,若放入Cache中的元素超过这个数值,则有以下两种情况 * 1)若overflowToDisk=true,则会将Cache中多出的元素放入磁盘文件中 * 2)若overflowToDisk=false,则根据memoryStoreEvictionPolicy策略替换Cache中原有的元素 * eternal==============缓存中对象是否永久有效,即是否永驻内存,true时将忽略timeToIdleSeconds和timeToLiveSeconds * timeToIdleSeconds====缓存数据在失效前的允许闲置时间(单位:秒),仅当eternal=false时使用,默认值是0表示可闲置时间无穷大,此为可选属性 * 即访问这个cache中元素的最大间隔时间,若超过这个时间没有访问此Cache中的某个元素,那么此元素将被从Cache中清除 * timeToLiveSeconds====缓存数据在失效前的允许存活时间(单位:秒),仅当eternal=false时使用,默认值是0表示可存活时间无穷大 * 即Cache中的某元素从创建到清楚的生存时间,也就是说从创建开始计时,当超过这个时间时,此元素将从Cache中清除 * overflowToDisk=======内存不足时,是否启用磁盘缓存(即内存中对象数量达到maxElementsInMemory时,Ehcache会将对象写到磁盘中) * 会根据标签中path值查找对应的属性值,写入磁盘的文件会放在path文件夹下,文件的名称是cache的名称,后缀名是data * diskPersistent=======是否持久化磁盘缓存,当这个属性的值为true时,系统在初始化时会在磁盘中查找文件名为cache名称,后缀名为index的文件 * 这个文件中存放了已经持久化在磁盘中的cache的index,找到后会把cache加载到内存 * 要想把cache真正持久化到磁盘,写程序时注意执行net.sf.ehcache.Cache.put(Element element)后要调用flush()方法 * diskExpiryThreadIntervalSeconds==磁盘缓存的清理线程运行间隔,默认是120秒 * diskSpoolBufferSizeMB============设置DiskStore(磁盘缓存)的缓存区大小,默认是30MB * memoryStoreEvictionPolicy========内存存储与释放策略,即达到maxElementsInMemory限制时,Ehcache会根据指定策略清理内存 * 共有三种策略,分别为LRU(最近最少使用)、LFU(最常用的)、FIFO(先进先出) --> <!-- 注意,以下缓存是永久有效,是系统初始化数据到缓存中,如果不需要永久有效,请另写,或在 --> <!-- <defaultCache maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true" maxElementsOnDisk="10000000" diskPersistent="false" diskExpiryThreadIntervalSeconds="120" memoryStoreEvictionPolicy="LRU" /> --> <defaultCache eternal="false" maxElementsInMemory="10000" overflowToDisk="false" diskPersistent="false" timeToIdleSeconds="0" timeToLiveSeconds="600" memoryStoreEvictionPolicy="LRU" /> <cache name="baseCache" eternal="false" maxElementsInMemory="1000" overflowToDisk="false" diskPersistent="false" timeToIdleSeconds="0" timeToLiveSeconds="300" memoryStoreEvictionPolicy="LRU" /> <!-- 登录记录缓存 锁定10分钟 --> <cache name="passwordRetryCache" maxEntriesLocalHeap="2000" eternal="false" timeToIdleSeconds="600" timeToLiveSeconds="0" overflowToDisk="false" statistics="true"> </cache> <cache name="authorizationCache" maxEntriesLocalHeap="2000" eternal="false" timeToIdleSeconds="1800" timeToLiveSeconds="0" overflowToDisk="false" statistics="true"> </cache> <cache name="authenticationCache" maxEntriesLocalHeap="2000" eternal="false" timeToIdleSeconds="1800" timeToLiveSeconds="0" overflowToDisk="false" statistics="true"> </cache> <cache name="shiro-activeSessionCache" maxEntriesLocalHeap="2000" eternal="false" timeToIdleSeconds="1800" timeToLiveSeconds="0" overflowToDisk="false" statistics="true"> </cache> </ehcache> spring-shiro.xml 配置 <?xml version="1.0" encoding="UTF-8"?> <
bean
s xmlns="http://www.springframework.org/schema/
bean
s" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/
bean
s http://www.springframework.org/schema/
bean
s/spring-
bean
s-4.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd" default-lazy-init="true" default-autowire="byName"> <description>Shiro Configuration</description> <!-- SHIRO CONFIG START --> <!-- 定义密码加密算法及迭代次数 --> <
bean
id="passwordHelper" class="com.leadbank.bcms.utils.PasswordHelper"> <
property
name="algorithmName" value="md5" /> <
property
name="hashIterations" value="2" /> </
bean
> <!-- 缓存管理器 使用Ehcache实现--> <
bean
id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager"> <
property
name="cacheManager" ref="ehCacheManager"/> </
bean
> <
bean
id="ehCacheManager" class ="org.springframework.cache.ehcache.EhCacheManagerFactory
Bean
"> <
property
name="configLocation" value="classpath:spring/ehcache.xml" /> <
property
name="shared" value="true"></
property
> </
bean
> <!-- 凭证匹配器 --> <
bean
id="credentialsMatcher" class="com.leadbank.bcms.controller.shiro.credential.RetryLimitHashedCredentialsMatcher"> <constructor-arg ref="cacheManager" /> <
property
name="hashAlgorithmName" value="md5" /> <
property
name="hashIterations" value="2" /> <
property
name="storedCredentialsHexEncoded" value="true" /> </
bean
> <
bean
id="userService" class="com.leadbank.bcms.service.user.impl.UserServiceImpl" /> <!-- 項目自定义的Realm --> <
bean
id="myShiroRealm" class="com.leadbank.bcms.controller.shiro.MyshiroRealm" > <
property
name="userService" ref="userService" /> <
property
name="credentialsMatcher" ref="credentialsMatcher" /> <
property
name="cachingEnabled" value="true" /> <
property
name="authenticationCachingEnabled" value="true" /> <
property
name="authenticationCacheName" value="authenticationCache" /> <
property
name="authorizationCachingEnabled" value="true" /> <
property
name="authorizationCacheName" value="authorizationCache" /> </
bean
> <
bean
id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"> <
property
name="realms"> <list><ref
bean
="myShiroRealm"/></list> </
property
> <
property
name="sessionManager" ref="sessionManager"/> <
property
name="cacheManager" ref="cacheManager"/> <
property
name="rememberMeManager" ref="rememberMeManager"/> </
bean
> <
bean
id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactory
Bean
"> <
property
name="securityManager" ref="securityManager" /> <
property
name="loginUrl" value="/login/loginIndex" /> <
property
name="successUrl" value="/backstage/index" /> <
property
name="unauthorizedUrl" value="/login/loginIndex" /> <
property
name="filterChainDefinitions"> <!-- anon:匿名拦截器,即不需要登录即可访问;一般用于静态资源过滤 authc:如果没有登录会跳到相应的登录页面登录 user:用户拦截器,用户已经身份验证/记住我登录的都可 --> <value> <!-- /static/js/system/login/** = anon /static/js/system/** = authc /static/** = anon /favicon.ico = anon /verifyCode/** = anon /system_login = anon /weixin/** = anon /upload/** = anon /** = authc /static/**/** = anon--> <!-- /test/toManagerIndex = roles[mg_001] --> /** = anon </value> </
property
> </
bean
> <!-- AOP式方法级权限检查 --> <
bean
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycle
Bean
PostProcessor"> <
property
name="proxyTargetClass" value="true" /> </
bean
> <!-- 保证实现了Shiro内部lifecycle函数的
bean
执行 --> <
bean
id="lifecycle
Bean
PostProcessor" class="org.apache.shiro.spring.Lifecycle
Bean
PostProcessor" /> </
bean
s> 启动报错 如下: 2016/09/07-17:59:41.148 [localhost-startStop-1] ERROR o.s.web.context.ContextLoader - Context initialization failed org.springframework.
bean
s.factory.
Bean
CreationException: Error creating
bean
with name 'shiroFilter' defined in URL [file:/E:/apache-tomcat-7.0.68/wtpwebapps/leadbank-bcms-manage/WEB-INF/classes/spring/spring-shiro.xml]:
Cannot
resolve
reference
to
bean
'securityManager' while
setting
bean
property
'securityManager'; nested exception is org.springframework.
bean
s.factory.
Bean
CreationException: Error creating
bean
with name 'securityManager' defined in URL [file:/E:/apache-tomcat-7.0.68/wtpwebapps/leadbank-bcms-manage/WEB-INF/classes/spring/spring-shiro.xml]:
Cannot
resolve
reference
to
bean
'myShiroRealm' while
setting
bean
property
'realms' with key [0]; nested exception is org.springframework.
bean
s.factory.
Bean
CreationException: Error creating
bean
with name 'myShiroRealm' defined in URL [file:/E:/apache-tomcat-7.0.68/wtpwebapps/leadbank-bcms-manage/WEB-INF/classes/spring/spring-shiro.xml]:
Cannot
resolve
reference
to
bean
'credentialsMatcher' while
setting
bean
property
'credentialsMatcher'; nested exception is org.springframework.
bean
s.factory.UnsatisfiedDependencyException: Error creating
bean
with name 'credentialsMatcher' defined in URL [file:/E:/apache-tomcat-7.0.68/wtpwebapps/leadbank-bcms-manage/WEB-INF/classes/spring/spring-shiro.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.apache.shiro.cache.Cache]: Could not convert constructor argument value of type [org.apache.shiro.cache.ehcache.EhCacheManager] to required type [org.apache.shiro.cache.Cache]: Failed to convert value of type 'org.apache.shiro.cache.ehcache.EhCacheManager' to required type 'org.apache.shiro.cache.Cache'; nested exception is java.lang.IllegalStateException:
Cannot
convert value of type [org.apache.shiro.cache.ehcache.EhCacheManager] to required type [org.apache.shiro.cache.Cache]: no matching editors or conversion strategy found
IDEA中配置数据源xml文件出现“
cannot
resolve
property
key”错误
啥都不会ccc的博客
06-27
3万+
一、问题描述如上图所示,上面标红的全是报错“无法解析属性”。二、解决办法我目前的解决办法是关闭右下角的检查,如下图:关闭后就不报错了。但是这个方法治标不治本,我会寻找其他的方法来解决这个问题。...
SpringMVC莫名其妙出现No
bean
named 'cacheManager' is defined错误
夕下奕林的专栏
06-29
1万+
在使用Interiij idea创建SpringMVC项目时,莫名其妙出现了No
bean
named ‘cacheManager’ is defined错误,但是项目里根本没有用到跟cache有关的东西。百度了很久都没有看到类似的,最后到Stack Overflow终于找到答案了,原来是在使用tx命名空间是,idea默认会引入cache,选择另一namespace就好,或者参照原帖方法:http:
©️2020 CSDN
皮肤主题: 精致技术
设计师:CSDN官方博客
返回首页