Skip to content

Instantly share code, notes, and snippets.

@altfatterz
Created June 28, 2014 21:17
Show Gist options
  • Save altfatterz/96cdd92cf47235660112 to your computer and use it in GitHub Desktop.
Save altfatterz/96cdd92cf47235660112 to your computer and use it in GitHub Desktop.
@Configuration
@EnableCaching
@Profile("ehcache")
public class EhCacheConfiguration {
@Bean
EhCacheCacheManager ehCacheCacheManager() {
return new EhCacheCacheManager(ehCacheManagerFactoryBean().getObject());
}
@Bean
EhCacheManagerFactoryBean ehCacheManagerFactoryBean() {
EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
return ehCacheManagerFactoryBean;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment