Does ehcache 3.8.1 no longer automatically pick up the configuration settings in an ehcache.xml file at the source root directory?
Asked
Active
Viewed 2,008 times
1 Answers
4
Yes, it's looks so, now it needs to be done using a XML file by configuringe a CacheManager at creation time, according to this schema definition.
XML programmatic parsing
If you are obtaining your CacheManager through the JSR-107 API, what follows is done automatically when invoking
javax.cache.spi.CachingProvider.getCacheManager(java.net.URI, java.lang.ClassLoader)
final URL myUrl = getClass().getResource("/configs/docs/getting-started.xml");
XmlConfiguration xmlConfig = new XmlConfiguration(myUrl);
CacheManager myCacheManager = CacheManagerBuilder.newCacheManager(xmlConfig);
myCacheManager.init();
- Obtain a URL to your XML file’s location
- Instantiate an XmlConfiguration passing the XML file’s URL to it
- Using the static
org.ehcache.config.builders.CacheManagerBuilder.newCacheManager(org.ehcache.config.Configuration)
allows you to create your CacheManager instance using the Configuration from the XmlConfiguration
- Initialize the cacheManager before it is used.
Reference - http://www.ehcache.org/documentation/3.8/xml.html

Devesh mehta
- 1,505
- 8
- 22