diff --git a/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheFactoryBean.java b/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheFactoryBean.java index eca8be9998..f984cdea04 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2016 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. @@ -16,7 +16,6 @@ package org.springframework.cache.ehcache; -import java.lang.reflect.Method; import java.util.Set; import net.sf.ehcache.Cache; @@ -37,8 +36,6 @@ import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.InitializingBean; -import org.springframework.util.ClassUtils; -import org.springframework.util.ReflectionUtils; /** * {@link FactoryBean} that creates a named EhCache {@link net.sf.ehcache.Cache} instance @@ -64,15 +61,6 @@ import org.springframework.util.ReflectionUtils; */ public class EhCacheFactoryBean extends CacheConfiguration implements FactoryBean, BeanNameAware, InitializingBean { - // EhCache's setStatisticsEnabled(boolean) available? Not anymore as of EhCache 2.7... - private static final Method setStatisticsEnabledMethod = - ClassUtils.getMethodIfAvailable(Ehcache.class, "setStatisticsEnabled", boolean.class); - - // EhCache's setSampledStatisticsEnabled(boolean) available? Not anymore as of EhCache 2.7... - private static final Method setSampledStatisticsEnabledMethod = - ClassUtils.getMethodIfAvailable(Ehcache.class, "setSampledStatisticsEnabled", boolean.class); - - protected final Log logger = LogFactory.getLog(getClass()); private CacheManager cacheManager; @@ -195,26 +183,6 @@ public class EhCacheFactoryBean extends CacheConfiguration implements FactoryBea this.cacheEventListeners = cacheEventListeners; } - /** - * Set whether to enable EhCache statistics on this cache. - *

Note: As of EhCache 2.7, statistics are enabled by default, and cannot be turned off. - * This setter therefore has no effect in such a scenario. - * @see net.sf.ehcache.Ehcache#setStatisticsEnabled - */ - public void setStatisticsEnabled(boolean statisticsEnabled) { - this.statisticsEnabled = statisticsEnabled; - } - - /** - * Set whether to enable EhCache's sampled statistics on this cache. - *

Note: As of EhCache 2.7, statistics are enabled by default, and cannot be turned off. - * This setter therefore has no effect in such a scenario. - * @see net.sf.ehcache.Ehcache#setSampledStatisticsEnabled - */ - public void setSampledStatisticsEnabled(boolean sampledStatisticsEnabled) { - this.sampledStatisticsEnabled = sampledStatisticsEnabled; - } - /** * Set whether this cache should be marked as disabled. * @see net.sf.ehcache.Cache#setDisabled @@ -276,14 +244,6 @@ public class EhCacheFactoryBean extends CacheConfiguration implements FactoryBea this.cacheManager.addCache(rawCache); } - // Only necessary on EhCache <2.7: As of 2.7, statistics are on by default. - if (this.statisticsEnabled && setStatisticsEnabledMethod != null) { - ReflectionUtils.invokeMethod(setStatisticsEnabledMethod, rawCache, true); - } - if (this.sampledStatisticsEnabled && setSampledStatisticsEnabledMethod != null) { - ReflectionUtils.invokeMethod(setSampledStatisticsEnabledMethod, rawCache, true); - } - if (this.disabled) { rawCache.setDisabled(true); } diff --git a/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java b/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java index 2287995b66..3440321c02 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java @@ -41,7 +41,7 @@ import org.springframework.core.io.Resource; * and cares for proper shutdown of the CacheManager. EhCacheManagerFactoryBean is * also necessary for loading EhCache configuration from a non-default config location. * - *

Note: As of Spring 4.1, Spring's EhCache support requires EhCache 2.5 or higher. + *

Note: As of Spring 5.0, Spring's EhCache support requires EhCache 2.10 or higher. * * @author Juergen Hoeller * @author Dmitriy Kopylenko