zoukankan      html  css  js  c++  java
  • cacheManager载入问题

    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:

    系统会创建cacheManager ,但是没有beanID,无法用注入方式获取chacheManager,用 ehcache.xml放入src根文件夹下,可自己主动创建cache,
    假设在随意文件夹,可在web.xml下加入listener用文件创建cacheManage的方式创建cache


    例如以下配置shiro的缓存时用到了EhCacheCacheManager,由于系统仅仅能创建一个EhCacheCacheManager

    所以要让自己的和系统的创建方式来自同一个地方。即使用在classpath路径下通过ehcache.xml配置。

    然后让自己和系统的都指向它就能够了,文件名称必须是ehcache.xml

    <bean id="ehCacheManager"
    class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
    <property name="configLocation" value="classpath:/ehcache.xml" />
    <property name="shared" value="true" />
    </bean>

    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
    <property name="cacheManager" ref="ehCacheManager" />
    </bean>
    <bean id="shiroCacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
    <property name="cacheManager" ref="ehCacheManager" />
    </bean>

         

  • 相关阅读:
    volatile关键字
    const关键字祥解
    extern关键字祥解
    gcc和g++使用澄清
    [APIO2014]连珠线
    点名
    四轮车
    盘子序列
    序列问题
    长途旅行
  • 原文地址:https://www.cnblogs.com/slgkaifa/p/7290682.html
Copyright © 2011-2022 走看看