Java Code Examples for org.springframework.cache.ehcache.EhCacheManagerFactoryBean

The following examples show how to use org.springframework.cache.ehcache.EhCacheManagerFactoryBean. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() throws IOException {
  String cacheMode = properties.getMode();

  switch (cacheMode) {
    case "single-nonpersistent":
      return getEhCacheManagerFactoryBean("ehcache/ehcache-single-nonpersistent.xml");
    case "single":
      return getEhCacheManagerFactoryBean("ehcache/ehcache-single.xml");
    case "multi":
      return getEhCacheManagerFactoryBean("ehcache/ehcache-multi.xml");
    default:
      throw new IOException(format("Unsupported cache mode specified: '%s'", cacheMode));
  }

  
}
 
Example 2
Source Project: MeetingFilm   Source File: ShiroConfig.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 缓存管理器 使用Ehcache实现
 */
@Bean
public CacheManager getCacheShiroManager(EhCacheManagerFactoryBean ehcache) {
    EhCacheManager ehCacheManager = new EhCacheManager();
    ehCacheManager.setCacheManager(ehcache.getObject());
    return ehCacheManager;
}
 
Example 3
Source Project: MeetingFilm   Source File: EhCacheConfig.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * EhCache的配置
 */
@Bean
public EhCacheManagerFactoryBean ehcache() {
    EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
    return ehCacheManagerFactoryBean;
}
 
Example 4
Source Project: WebStack-Guns   Source File: ShiroConfig.java    License: MIT License 5 votes vote down vote up
/**
 * 缓存管理器 使用Ehcache实现
 */
@Bean
public CacheManager getCacheShiroManager(EhCacheManagerFactoryBean ehcache) {
    EhCacheManager ehCacheManager = new EhCacheManager();
    ehCacheManager.setCacheManager(ehcache.getObject());
    return ehCacheManager;
}
 
Example 5
Source Project: WebStack-Guns   Source File: EhCacheConfig.java    License: MIT License 5 votes vote down vote up
/**
 * EhCache的配置
 */
@Bean
public EhCacheManagerFactoryBean ehcache() {
    EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
    return ehCacheManagerFactoryBean;
}
 
Example 6
Source Project: chronus   Source File: EhCacheConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public EhCacheManagerFactoryBean cacheManager() {
    ClassPathResource config = new ClassPathResource("/cache/ehcache-local.xml");
    EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    ehCacheManagerFactoryBean.setConfigLocation(config);
    log.debug("EhCacheManagerFactoryBean初始化完成");
    return ehCacheManagerFactoryBean;
}
 
Example 7
Source Project: kvf-admin   Source File: EhCacheConfig.java    License: MIT License 5 votes vote down vote up
@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactoryBean() {
    EhCacheManagerFactoryBean cacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    cacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));     // 缓存信息配置文件
    cacheManagerFactoryBean.setShared(true);
    return cacheManagerFactoryBean;
}
 
Example 8
Source Project: FlyCms   Source File: EhCacheConfig.java    License: MIT License 5 votes vote down vote up
/**
 * EhCache的配置
 */
@Bean
public EhCacheManagerFactoryBean ehcache() {
    EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
    return ehCacheManagerFactoryBean;
}
 
Example 9
Source Project: api-layer   Source File: CacheConfig.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Bean
public EhCacheManagerFactoryBean ehCacheCacheManager() {
    EhCacheManagerFactoryBean cmfb = new EhCacheManagerFactoryBean();
    cmfb.setConfigLocation(new ClassPathResource("ehcache.xml"));
    cmfb.setShared(true);
    return cmfb;
}
 
Example 10
Source Project: MicroCommunity   Source File: CacheConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactoryBean(){
    EhCacheManagerFactoryBean cacheManagerFactoryBean = new EhCacheManagerFactoryBean ();
    cacheManagerFactoryBean.setConfigLocation (new ClassPathResource("cache/ehcache-app.xml"));
    cacheManagerFactoryBean.setShared (true);
    return cacheManagerFactoryBean;
}
 
Example 11
Source Project: Spring-5.0-Cookbook   Source File: SpringDispatcherConfig.java    License: MIT License 5 votes vote down vote up
@Bean
public EhCacheManagerFactoryBean ehCacheCacheManager() {
	EhCacheManagerFactoryBean cmfb = new EhCacheManagerFactoryBean();
	cmfb.setConfigLocation(resourceLoader.getResource("classpath:ehcache.xml"));
	
	cmfb.setShared(true);
	return cmfb;
}
 
Example 12
Source Project: cc-s   Source File: CacheConfig.java    License: MIT License 5 votes vote down vote up
/**
 * ehcache工厂
 * @return
 */
@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactoryBean(){
    EhCacheManagerFactoryBean cacheManagerFactoryBean = new EhCacheManagerFactoryBean ();
    cacheManagerFactoryBean.setConfigLocation (new ClassPathResource(env.getProperty("ehcache.config-location")));
    cacheManagerFactoryBean.setShared(Boolean.valueOf(env.getProperty("shared")));
    return cacheManagerFactoryBean;
}
 
Example 13
Source Project: Spring-Boot-Blog   Source File: CacheConfiguration.java    License: MIT License 5 votes vote down vote up
@Bean
public EhCacheManagerFactoryBean ehCacheManagerFactoryBean(){
    EhCacheManagerFactoryBean cacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    cacheManagerFactoryBean.setConfigLocation (new ClassPathResource("conf/ehcache.xml"));
    cacheManagerFactoryBean.setShared(true);
    return cacheManagerFactoryBean;
}
 
Example 14
Source Project: web-flash   Source File: EhCacheConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public EhCacheManagerFactoryBean ehcache() {
    EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
    return ehCacheManagerFactoryBean;
}
 
Example 15
Source Project: txle   Source File: EhCacheConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public EhCacheManagerFactoryBean ehcache() {
    EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
    return ehCacheManagerFactoryBean;
}
 
Example 16
Source Project: Project   Source File: CachingConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public EhCacheManagerFactoryBean ehcache() {
	EhCacheManagerFactoryBean ehCacheFactoryBean = new EhCacheManagerFactoryBean();
	ehCacheFactoryBean.setConfigLocation(new ClassPathResource("spittr/cache/ehcache.xml"));
	return ehCacheFactoryBean;
}
 
Example 17
Source Project: flash-waimai   Source File: EhCacheConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public EhCacheManagerFactoryBean ehcache() {
    EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
    ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("ehcache.xml"));
    return ehCacheManagerFactoryBean;
}
 
Example 18
@Bean
public EhCacheManagerFactoryBean getEhCacheFactory() {
  EhCacheManagerFactoryBean factoryBean = new EhCacheManagerFactoryBean();
  factoryBean.setConfigLocation(new ClassPathResource("crowd-ehcache.xml"));
  return factoryBean;
}
 
Example 19
Source Project: ods-provisioning-app   Source File: BasicAuthConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public EhCacheManagerFactoryBean getEhCacheFactory() {
  EhCacheManagerFactoryBean factoryBean = new EhCacheManagerFactoryBean();
  factoryBean.setConfigLocation(new ClassPathResource("crowd-ehcache.xml"));
  return factoryBean;
}
 
Example 20
@Bean
public EhCacheManagerFactoryBean cacheManagerFactoryBean() {
	EhCacheManagerFactoryBean cacheManager = new EhCacheManagerFactoryBean();
	return cacheManager;
}
 
Example 21
Source Project: MicroCommunity   Source File: CacheConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
@Bean(name = "appEhCacheCacheManager")
public EhCacheCacheManager ehCacheCacheManager(EhCacheManagerFactoryBean bean){
    return new EhCacheCacheManager (bean.getObject());
}
 
Example 22
private EhCacheManagerFactoryBean getEhCacheManagerFactoryBean(String configLocation) {
  EhCacheManagerFactoryBean bean = new EhCacheManagerFactoryBean();
  bean.setConfigLocation(new ClassPathResource(configLocation));
  bean.setShared(true);
  return bean;
}
 
Example 23
/**
 * @see AbstractCacheManagerAndProviderFacadeParser#getCacheManagerClass()
 */
protected Class getCacheManagerClass() {
  return EhCacheManagerFactoryBean.class;
}
 
Example 24
Source Project: tutorials   Source File: ACLContext.java    License: MIT License 4 votes vote down vote up
@Bean
public EhCacheManagerFactoryBean aclCacheManager() {
    return new EhCacheManagerFactoryBean();
}
 
Example 25
Source Project: kvf-admin   Source File: EhCacheConfig.java    License: MIT License 2 votes vote down vote up
/**
 * ehcache 主要的管理器
 *
 * @param cacheManagerFactoryBean cm
 * @return ec
 */
@Bean
public EhCacheCacheManager ehCacheCacheManager(EhCacheManagerFactoryBean cacheManagerFactoryBean) {
    return new EhCacheCacheManager(cacheManagerFactoryBean.getObject());
}
 
Example 26
Source Project: cc-s   Source File: CacheConfig.java    License: MIT License 2 votes vote down vote up
/**
 *  ehcache管理器
 * @param bean
 * @return
 */
@Bean
public EhCacheCacheManager ehCacheCacheManager(EhCacheManagerFactoryBean bean){
    return new EhCacheCacheManager(bean.getObject());
}