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

六眼飞鱼酱① 提交于 2019-11-29 09:11:53

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

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">

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!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!