October 2017
Intermediate to advanced
396 pages
10h 2m
English
Ehcache is one of the most popular cache providers. Spring allows you to integrate with Ehcache by configuring EhCacheCacheManager in the application. Take for example, the following Java configuration:
@Bean
public CacheManager cacheManager(CacheManager ehCache) {
EhCacheCacheManager cmgr = new EhCacheCacheManager();
cmgr.setCacheManager(ehCache);
return cmgr;
}
@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() {
EhCacheManagerFactoryBean eh = new EhCacheManagerFactoryBean();
eh.setConfigLocation(new ClassPathResource("resources/ehcache.xml"));
return eh;
}
In the preceding code, the bean method, cacheManager(), creates an object of EhCacheCacheManager, and set it with the CacheManager of Ehcache. ...
Read now
Unlock full access