Is it possible to use multiple ehcache.xml (in different projects, same war)?

后端 未结 3 1473
隐瞒了意图╮
隐瞒了意图╮ 2020-12-18 19:34

I have a services project and a web project. I need to have eh-cache in both projects.

The idea is that if the service project is updated, it\'s cache-related change

相关标签:
3条回答
  • 2020-12-18 19:56

    The configurationResourceName property is used to specify the location of the ehcache configuration file.The resource is searched for in the root of the classpath. It is used to support multiple CacheManagers in the same VM.

    net.sf.ehcache.configurationResourceName=/name_of_ehcache.xml
    
    0 讨论(0)
  • 2020-12-18 20:08

    Try naming both cacheManagers differently in ehcache.xml

    <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        name="ehCacheManager1">
    
    
    <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        name="ehCacheManager2">
    
    0 讨论(0)
  • 2020-12-18 20:13

    if you use different cache for different WAR and you want to prevent collisions, go to echcache.xml of each WAR and define different multicastGroupPort values under cacheManagerPeerProviderFactory element. also disable distribution.

    Good luck!

    0 讨论(0)
提交回复
热议问题