Search in sources :

Example 1 with EhCacheManagerFactoryBean

use of org.springframework.cache.ehcache.EhCacheManagerFactoryBean in project cas by apereo.

the class EhcacheTicketRegistryConfiguration method cacheManager.

@Lazy
@Bean
public EhCacheManagerFactoryBean cacheManager() {
    final EhcacheProperties cache = casProperties.getTicket().getRegistry().getEhcache();
    final EhCacheManagerFactoryBean bean = new EhCacheManagerFactoryBean();
    bean.setConfigLocation(cache.getConfigLocation());
    bean.setShared(cache.isShared());
    bean.setCacheManagerName(cache.getCacheManagerName());
    return bean;
}
Also used : EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) EhcacheProperties(org.apereo.cas.configuration.model.support.ehcache.EhcacheProperties) Lazy(org.springframework.context.annotation.Lazy) EhCacheFactoryBean(org.springframework.cache.ehcache.EhCacheFactoryBean) EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with EhCacheManagerFactoryBean

use of org.springframework.cache.ehcache.EhCacheManagerFactoryBean in project sppanblog4springboot by whoismy8023.

the class CacheConfig method ehCacheManagerFactoryBean.

/**
 * 据shared与否的设置,Spring分别通过CacheManager.create()或new CacheManager()方式来创建一个ehcache基地.
 */
@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() {
    EhCacheManagerFactoryBean cacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    cacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
    cacheManagerFactoryBean.setShared(true);
    return cacheManagerFactoryBean;
}
Also used : EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) ClassPathResource(org.springframework.core.io.ClassPathResource) EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 3 with EhCacheManagerFactoryBean

use of org.springframework.cache.ehcache.EhCacheManagerFactoryBean in project ocvn by devgateway.

the class CacheConfiguration method ehCacheManagerFactoryBean.

@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() {
    EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
    ehCacheManagerFactoryBean.setShared(true);
    return ehCacheManagerFactoryBean;
}
Also used : EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) ClassPathResource(org.springframework.core.io.ClassPathResource) EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with EhCacheManagerFactoryBean

use of org.springframework.cache.ehcache.EhCacheManagerFactoryBean in project openmrs-core by openmrs.

the class CacheConfig method apiCacheManagerFactoryBean.

@Bean(name = "apiCacheManagerFactoryBean")
public EhCacheManagerFactoryBean apiCacheManagerFactoryBean() {
    OpenmrsCacheManagerFactoryBean cacheManagerFactoryBean = new OpenmrsCacheManagerFactoryBean();
    cacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache-api.xml"));
    cacheManagerFactoryBean.setShared(false);
    cacheManagerFactoryBean.setAcceptExisting(true);
    return cacheManagerFactoryBean;
}
Also used : ClassPathResource(org.springframework.core.io.ClassPathResource) EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Example 5 with EhCacheManagerFactoryBean

use of org.springframework.cache.ehcache.EhCacheManagerFactoryBean in project vip by guangdada.

the class ShiroConfig method getCacheShiroManager.

/**
 * 缓存管理器 使用Ehcache实现
 */
@Bean
public CacheManager getCacheShiroManager(EhCacheManagerFactoryBean ehcache) {
    EhCacheManager ehCacheManager = new EhCacheManager();
    ehCacheManager.setCacheManager(ehcache.getObject());
    return ehCacheManager;
}
Also used : EhCacheManager(org.apache.shiro.cache.ehcache.EhCacheManager) ShiroFilterFactoryBean(org.apache.shiro.spring.web.ShiroFilterFactoryBean) MethodInvokingFactoryBean(org.springframework.beans.factory.config.MethodInvokingFactoryBean) EhCacheManagerFactoryBean(org.springframework.cache.ehcache.EhCacheManagerFactoryBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

EhCacheManagerFactoryBean (org.springframework.cache.ehcache.EhCacheManagerFactoryBean)12 Bean (org.springframework.context.annotation.Bean)11 ClassPathResource (org.springframework.core.io.ClassPathResource)7 EhCacheFactoryBean (org.springframework.cache.ehcache.EhCacheFactoryBean)3 EhcacheProperties (org.apereo.cas.configuration.model.support.ehcache.EhcacheProperties)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)2 lombok.val (lombok.val)1 EhCacheManager (org.apache.shiro.cache.ehcache.EhCacheManager)1 ShiroFilterFactoryBean (org.apache.shiro.spring.web.ShiroFilterFactoryBean)1 MethodInvokingFactoryBean (org.springframework.beans.factory.config.MethodInvokingFactoryBean)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1 Lazy (org.springframework.context.annotation.Lazy)1