40 lines
1.1 KiB
Java
40 lines
1.1 KiB
Java
/*package com.jasamedika.medifirst2000.chace;
|
|
|
|
import org.springframework.cache.CacheManager;
|
|
import org.springframework.cache.annotation.EnableCaching;
|
|
import org.springframework.cache.ehcache.EhCacheCacheManager;
|
|
import org.springframework.cache.ehcache.EhCacheManagerFactoryBean;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
|
|
|
|
|
@Configuration
|
|
@EnableCaching
|
|
@ComponentScan({ "com.jasamedika.*" })
|
|
public class ChaceConfig {
|
|
|
|
@Bean
|
|
public CacheManager cacheManager() {
|
|
return new EhCacheCacheManager(ehCacheCacheManager().getObject());
|
|
}
|
|
|
|
|
|
|
|
@Bean
|
|
public EhCacheManagerFactoryBean ehCacheCacheManager() {
|
|
EhCacheManagerFactoryBean cmfb = new EhCacheManagerFactoryBean();
|
|
cmfb.setConfigLocation(new ClassPathResource("ehcache.xml"));
|
|
cmfb.setShared(true);
|
|
|
|
return cmfb;
|
|
}
|
|
|
|
@Bean
|
|
public CacheManager defaultCacheManager() {
|
|
return new ConcurrentMapCacheManager("books");
|
|
}
|
|
|
|
}*/ |