From c07eb6bb9aa89e347911ac8882dd83ade9883ad1 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 4 Jul 2011 22:14:05 +0000 Subject: [PATCH] added "disabled" property to EhCacheFactoryBean --- .../cache/ehcache/EhCacheFactoryBean.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/org.springframework.context/src/main/java/org/springframework/cache/ehcache/EhCacheFactoryBean.java b/org.springframework.context/src/main/java/org/springframework/cache/ehcache/EhCacheFactoryBean.java index 7f179ed5e3..f2ec123a98 100644 --- a/org.springframework.context/src/main/java/org/springframework/cache/ehcache/EhCacheFactoryBean.java +++ b/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, BeanNameAware, private Set cacheEventListeners; + private boolean disabled = false; + private String beanName; private Ehcache cache; @@ -266,6 +268,14 @@ public class EhCacheFactoryBean implements FactoryBean, 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, BeanNameAware, cache.getCacheEventNotificationService().registerListener(listener); } } - + if (this.disabled) { + cache.setDisabled(true); + } return cache; }