java110
2021-05-05 2d079ac843ebcb335f2ef7d6952f9700a16fddde
java110-core/src/main/java/com/java110/core/cache/CacheConfiguration.java
old mode 100644 new mode 100755
@@ -1,35 +1,31 @@
package com.java110.core.cache;
import com.java110.core.factory.AppFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.ehcache.EhCacheCacheManager;
import org.springframework.cache.ehcache.EhCacheManagerFactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.ClassPathResource;
/**
 * Created by wuxw on 2017/7/23.
 */
@Configurable
@EnableCaching
//@Configurable
//@EnableCaching
public class CacheConfiguration  {
    /*
    * ehcache 主要的管理器
    */
    @Bean(name = "appEhCacheCacheManager")
    //@Bean(name = "appEhCacheCacheManager")
    public EhCacheCacheManager ehCacheCacheManager(EhCacheManagerFactoryBean bean){
        return new EhCacheCacheManager (bean.getObject ());
        return new EhCacheCacheManager (bean.getObject());
    }
    /*
     * 据shared与否的设置,Spring分别通过CacheManager.create()或new CacheManager()方式来创建一个ehcache基地.
     */
    @Bean
    //@Bean
    public EhCacheManagerFactoryBean ehCacheManagerFactoryBean(){
        EhCacheManagerFactoryBean cacheManagerFactoryBean = new EhCacheManagerFactoryBean ();
        cacheManagerFactoryBean.setConfigLocation (new ClassPathResource("cache/ehcache-app.xml"));