zoukankan      html  css  js  c++  java
  • 关于Springboot 中注入多个cacheManage 时候 存在报错

    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ehcache' defined in class path resource [applicationContext-ehcache.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 the config or do one of following:
    1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
    2. Shutdown the earlier cacheManager before creating new one with same name.
    The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1512)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:320)
    ... 76 more

    背景:

     注入了redis ehcache  和自定义的ehcahe    

    这时候cachemanager 存在以上异常

     解决办法

    ,share修改为true。这样EhCacheManagerFactoryBean内部在得到shared信息就不会重复重复创建cache了。

  • 相关阅读:
    元素水平居中方式
    JQuery 之事件中的 ----- hover 与 onmouseover 、onmouseout 联系
    JQuery 获取指定url对应的html内容
    BOM 窗体相关属性以及页面可见区域的获取方式
    使用supervisor提高nodejs调试效率
    Jquery on() 动态绑定事件
    局部打印插件 jquery.PrintArea.js
    深入理解BFC和Margin Collapse
    Sublime Text 2 安装Package Control和插件的两种方法
    001 数据库基本概念和操作
  • 原文地址:https://www.cnblogs.com/java-synchronized/p/9707869.html
Copyright © 2011-2022 走看看