Created
August 14, 2017 10:57
-
-
Save milanboers/9b68b1c38a29556fb83a640eb81df586 to your computer and use it in GitHub Desktop.
Spring Cache + Ehcache 3 configuration (JCache / JSR107)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@EnableCaching | |
public class CacheConfiguration { | |
@Bean | |
public JCacheManagerFactoryBean cacheManagerFactoryBean() throws Exception { | |
JCacheManagerFactoryBean jCacheManagerFactoryBean = new JCacheManagerFactoryBean(); | |
jCacheManagerFactoryBean.setCacheManagerUri(new ClassPathResource("ehcache.xml").getURI()); | |
return jCacheManagerFactoryBean; | |
} | |
@Bean | |
public CacheManager cacheManager() throws Exception { | |
final JCacheCacheManager jCacheCacheManager = new JCacheCacheManager(); | |
jCacheCacheManager.setCacheManager(cacheManagerFactoryBean().getObject()); | |
return jCacheCacheManager; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment