added "disabled" property to EhCacheFactoryBean

master
Juergen Hoeller 13 years ago
parent b0a6ebfb61
commit c07eb6bb9a
  1. 16
      org.springframework.context/src/main/java/org/springframework/cache/ehcache/EhCacheFactoryBean.java

@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -99,6 +99,8 @@ public class EhCacheFactoryBean implements FactoryBean<Ehcache>, BeanNameAware,
private Set<CacheEventListener> cacheEventListeners;
private boolean disabled = false;
private String beanName;
private Ehcache cache;
@ -266,6 +268,14 @@ public class EhCacheFactoryBean implements FactoryBean<Ehcache>, BeanNameAware,
this.cacheEventListeners = cacheEventListeners;
}
/**
* Set whether this cache should be marked as disabled.
* @see net.sf.ehcache.Cache#setDisabled
*/
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}
public void setBeanName(String name) {
this.beanName = name;
}
@ -331,7 +341,9 @@ public class EhCacheFactoryBean implements FactoryBean<Ehcache>, BeanNameAware,
cache.getCacheEventNotificationService().registerListener(listener);
}
}
if (this.disabled) {
cache.setDisabled(true);
}
return cache;
}

Loading…
Cancel
Save