首页>代码>Springboot开发的客户关系管理系统SpringbootCRM>/SpringbootCRM/src/main/java/com/springboot/config/EhCacheConfig.java
package com.springboot.config; import net.sf.ehcache.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.Configuration; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import com.springboot.core.shiro.spring.SpringCacheManagerWrapper; /** * * @Description: 功能描述 * @author [ Wenfeng.Huang ] on [2018年8月24日下午5:24:45] * @Modified By: [修改人] on [修改日期] for [修改说明] * */ @Configuration @EnableCaching public class EhCacheConfig { /** * 缓存管理器 * * @return */ @Bean public SpringCacheManagerWrapper cacheManager(EhCacheCacheManager springCacheManager) { SpringCacheManagerWrapper cacheManager = new SpringCacheManagerWrapper(); cacheManager.setCacheManager(springCacheManager); return cacheManager; } /** * EhCache的配置 */ @Bean public EhCacheCacheManager springCacheManager(CacheManager cacheManager) { return new EhCacheCacheManager(cacheManager); } /** * EhCache的配置 */ @Bean public EhCacheManagerFactoryBean ehcacheManager() { EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean(); Resource resource = new ClassPathResource("ehcache.xml"); ehCacheManagerFactoryBean.setConfigLocation(resource); return ehCacheManagerFactoryBean; } }
最近下载更多