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

}
最近下载更多
shuangfu  LV25 2024年5月7日
liangju666  LV6 2024年4月27日
xiaokang1  LV10 2024年4月23日
不顾asdf  LV7 2024年4月8日
五折也挺好的  LV13 2024年3月28日
ChenZheMeng  LV3 2024年3月22日
森sdfgf  LV8 2024年2月8日
lilong007  LV23 2023年12月30日
zhangyong  LV3 2023年12月18日
45436683  LV8 2023年10月10日
最近浏览更多
尼可曲奇 3月3日
暂无贡献等级
陈小灏  LV18 2月21日
17600446733  LV21 2024年12月10日
sjwc88  LV3 2024年12月4日
haomc052829  LV4 2024年12月3日
xianyu091012  LV5 2024年11月18日
是数据库  LV3 2024年11月4日
educationAAA  LV11 2024年11月4日
charleswang  LV7 2024年10月21日
微信网友_5795397379264512  LV1 2024年10月18日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友