Example usage for org.springframework.cache.ehcache EhCacheManagerFactoryBean afterPropertiesSet

List of usage examples for org.springframework.cache.ehcache EhCacheManagerFactoryBean afterPropertiesSet

Introduction

In this page you can find the example usage for org.springframework.cache.ehcache EhCacheManagerFactoryBean afterPropertiesSet.

Prototype

@Override
    public void afterPropertiesSet() throws CacheException 

Source Link

Usage

From source file:net.slipp.config.MainConfig.java

@Bean
public CacheManager cacheManager() throws CacheException, IOException {
    EhCacheCacheManager cacheManager = new EhCacheCacheManager();

    EhCacheManagerFactoryBean factoryBean = new EhCacheManagerFactoryBean();
    factoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
    factoryBean.afterPropertiesSet();
    cacheManager.setCacheManager(factoryBean.getObject());
    return cacheManager;
}

From source file:ru.anr.base.dao.AbstractDaoConfig.java

/**
 * Definition of CacheManager. We use EhCache
 * /*  w w  w.  java  2  s  .  co  m*/
 * @return An instance of {@link CacheManager} interface
 */
@Bean(name = "cacheManager")
public CacheManager cacheManager() {

    EhCacheManagerFactoryBean factory = new EhCacheManagerFactoryBean();
    factory.setAcceptExisting(true);
    factory.setShared(false);
    factory.setConfigLocation(new ClassPathResource("ehcache.xml"));

    factory.afterPropertiesSet();

    EhCacheCacheManager mgr = new EhCacheCacheManager();
    mgr.setCacheManager(factory.getObject());
    mgr.setTransactionAware(true);
    mgr.afterPropertiesSet();

    return mgr;
}

From source file:nl.surfnet.coin.api.GroupProviderConfigurationTest.java

@Bean(name = "cacheManager")
public CacheManager cacheManager() {
    EhCacheCacheManager cacheManager = new EhCacheCacheManager();
    EhCacheManagerFactoryBean factoryBean = new EhCacheManagerFactoryBean();
    factoryBean.setConfigLocation(new ClassPathResource("api-ehcache.xml"));
    try {//from www.  j  a  v  a  2  s  . c om
        factoryBean.afterPropertiesSet();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    cacheManager.setCacheManager(factoryBean.getObject());
    return cacheManager;
}

From source file:nl.surfnet.coin.api.service.JanusClientDetailsServiceTest.java

@Bean
public CacheManager cacheManager() {
    EhCacheCacheManager cacheManager = new EhCacheCacheManager();
    EhCacheManagerFactoryBean factoryBean = new EhCacheManagerFactoryBean();
    factoryBean.setConfigLocation(new ClassPathResource("api-ehcache.xml"));
    try {//w w w.ja va  2s. c  o  m
        factoryBean.afterPropertiesSet();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    cacheManager.setCacheManager(factoryBean.getObject());
    return cacheManager;
}