• 关于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了。

  • 相关阅读:
    bootstrap如何设置每一个选项卡对应一个页面
    SpringBoot集成百度UEditor图片上传后直接访问404解决办法
    从0开始完成SpringBoot+Mybatis实现增删改查
    Luarocks 安装艰难过程
    [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)')))
    python + selenium 搭建环境步骤
    mongodb的安装
    git-新建git用户流程-1
    git-关联远程git仓库详细步骤-2
    Django启动服务的流程
  • 原文地址:https://www.cnblogs.com/java-synchronized/p/9707869.html
Copyright © 2020-2023  润新知