spring 整合 ehcache失败记录

在尝试将Spring与Ehcache进行整合时,遇到了由于Ehcache 2.5以后的版本CacheManager采用Singleton导致的错误。错误源于项目同时引用了Shiro框架,使得存在多个CacheManager。官方文档提供了解释。解决办法是在配置bean时添加来指定缓存管理器为共享模式,从而消除多CacheManager问题。
摘要由CSDN通过智能技术生成

按照网上教程进行 spring 与 ehcache 整合,整合后启动项目发现报错,报错信息如下:

[ERROR][2017-08-07 11:01:07] org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:350) Context initialization failed 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.interceptor.CacheInterceptor#0': Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager' defined in URL [jar:file:/E:/apache-tomcat-7.0.68/webapps/renren-web/WEB-INF/lib/renren-common-2.1.0.jar!/renren-cache.xml]: Cannot resolve reference to bean 'ehcache' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehcache' defined in URL [jar:file:/E:/apache-tomcat-7.0.68/webapps/renren-web/WEB-INF/lib/renren-common-2.1.0.jar!/renren-cache.xml]: Invocation of init method failed; nested exception is net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in t
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值