Example usage for org.springframework.cache.ehcache EhCacheCacheManager setTransactionAware

List of usage examples for org.springframework.cache.ehcache EhCacheCacheManager setTransactionAware

Introduction

In this page you can find the example usage for org.springframework.cache.ehcache EhCacheCacheManager setTransactionAware.

Prototype

public void setTransactionAware(boolean transactionAware) 

Source Link

Document

Set whether this CacheManager should expose transaction-aware Cache objects.

Usage

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

/**
 * Definition of CacheManager. We use EhCache
 * // w  ww  .  ja v  a2 s  . com
 * @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;
}