• 解决Ehcache缓存警告问题


    警告: Creating a new instance of CacheManager using the diskStorePath "D:Apache Tomcat 6.0.18 emp" which is already used by an existing CacheManager.
    The source of the configuration was classpath.
    The diskStore path for this CacheManager will be set to D:Apache Tomcat 6.0.18 empehcache_auto_created_1262783591937.
    To avoid this warning consider using the CacheManager factory methods to create a singleton CacheManager or specifying a separate ehcache configuration (ehcache.xml) for each CacheManager instance.

    需要设置2个地方解决这个问题

    1.hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory

    注意需要是Singleton的EhCacheRegionFactory

    2.Spring EhCache Beans配置

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

    注意这里一定要设置shared为true

  • 相关阅读:
    e552. 取Applet的参数
    e551. 精简的Applet
    e558. 在Applet中多图片交互显示
    e1087. try/catch语句
    e1086. if/else语句
    e1087. 用For循环做数组的遍历
    e1084. 捕获错误和异常
    Zookeeper 应用程序
    Zookeeper API
    Java并发编程:volatile关键字解析
  • 原文地址:https://www.cnblogs.com/igtea/p/3831183.html
Copyright © 2020-2023  润新知