首页>代码>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;
    }

}
最近下载更多
xiaokang1  LV10 4月23日
不顾asdf  LV7 4月8日
五折也挺好的  LV13 3月28日
ChenZheMeng  LV3 3月22日
森sdfgf  LV8 2月8日
lilong007  LV20 2023年12月30日
zhangyong  LV3 2023年12月18日
45436683  LV8 2023年10月10日
wpkm2008  LV12 2023年8月14日
tonghao  LV18 2023年6月17日
最近浏览更多
860421  LV3 4月18日
Gin19960217  LV4 4月15日
zolscy  LV12 4月9日
slf123 4月9日
暂无贡献等级
不顾asdf  LV7 4月8日
m5433661  LV2 3月28日
m5433660  LV1 3月28日
ChenZheMeng  LV3 3月22日
Sinerliu 3月19日
暂无贡献等级
welcome丶  LV8 3月11日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友