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了。

  • 相关阅读:
    zt:HttpUrlConnection使用详解
    使用HttpUrlConnection访问www.163.com遇到503问题,用设置代理加以解决
    『TensorFlow』第十弹_队列&多线程_道路多坎坷
    『TensorFlow』项目资源分享
    『Python』socket网络编程
    『TensorFlow』第九弹_图像预处理_不爱红妆爱武装
    『TensorFlow』迁移学习
    『TensorFlow』函数查询列表_神经网络相关
    『TensorFlow』函数查询列表_张量属性调整
    『TensorFlow』函数查询列表_数值计算
  • 原文地址:https://www.cnblogs.com/java-synchronized/p/9707869.html
Copyright © 2011-2022 走看看