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

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

Introduction

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

Prototype

public void setShared(boolean shared) 

Source Link

Document

Set whether the EhCache CacheManager should be shared (as a singleton at the ClassLoader level) or independent (typically local within the application).

Usage

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

/**
 * Definition of CacheManager. We use EhCache
 * //from  w  w  w .j av  a2 s.c  o  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:fi.m1kah.config.AppConfig.java

@Bean()
public EhCacheManagerFactoryBean cacheManagerFactory() {
    EhCacheManagerFactoryBean factory = new EhCacheManagerFactoryBean();
    factory.setConfigLocation(new ClassPathResource("ehcache.xml"));
    factory.setShared(true);
    return factory;
}

From source file:com.gong.illidan.config.cache.CacheConfiguration.java

@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() {
    EhCacheManagerFactoryBean cacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    cacheManagerFactoryBean.setConfigLocation(new ClassPathResource("conf/ehcache.xml"));
    cacheManagerFactoryBean.setShared(true);
    return cacheManagerFactoryBean;
}

From source file:com.rakesh.rp3599.config.EhCacheConfiguration.java

@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() {

    EhCacheManagerFactoryBean cacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    cacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
    cacheManagerFactoryBean.setShared(true);

    return cacheManagerFactoryBean;
}

From source file:io.gravitee.repository.ehcache.cache.EhCacheRepositoryConfiguration.java

@Bean
public EhCacheManagerFactoryBean getEhCacheFactory() {
    String graviteeHome = System.getProperty("gravitee.home");
    String ehCacheConfiguration = graviteeHome + File.separator + "config" + File.separator + "ehcache.xml";
    File ehCacheConfigurationFile = new File(ehCacheConfiguration);

    LOGGER.info("Loading EHCache configuration from {}", ehCacheConfiguration);

    if (!ehCacheConfigurationFile.exists()) {
        LOGGER.warn("No configuration file can be found for EHCache");
        throw new IllegalStateException("No configuration file can be found for EHCache");
    }//from  w w  w  . j av a2  s  . com

    EhCacheManagerFactoryBean factoryBean = new EhCacheManagerFactoryBean();
    factoryBean.setConfigLocation(new FileSystemResource(ehCacheConfigurationFile));
    factoryBean.setShared(true);
    return factoryBean;
}

From source file:org.devgateway.toolkit.persistence.spring.CacheConfiguration.java

@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() {
    EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
    ehCacheManagerFactoryBean.setShared(true);
    return ehCacheManagerFactoryBean;
}

From source file:de.kaiserpfalzEdv.infopir.backend.db.PersistenceConfiguration.java

@Bean
public EhCacheManagerFactoryBean ehCacheCacheManager() {
    EhCacheManagerFactoryBean cmfb = new EhCacheManagerFactoryBean();
    cmfb.setConfigLocation(new ClassPathResource("ehcache.xml"));
    cmfb.setShared(true);
    return cmfb;/*from   w w w .  j a v  a 2 s .com*/
}

From source file:com.github.lanimall.ehcache2.AppConfig.java

@Bean
public EhCacheManagerFactoryBean getEhCacheManagerFactory() {
    String ehcacheConfigPath = System.getProperty("ehcache.config.path", "classpath:ehcache.xml");
    EhCacheManagerFactoryBean bean = new EhCacheManagerFactoryBean();
    bean.setConfigLocation(resourceLoader.getResource(ehcacheConfigPath));
    bean.setCacheManagerName("cachetest-springcacheable");
    bean.setShared(true);
    return bean;/*from   w  w w .j ava2s  .c o  m*/
}