From 64bf33038ded5a2432f240246b91e9272d46ec1d Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 11 Nov 2021 13:02:41 +0000 Subject: [PATCH] Remove support for EhCache 2 Closes gh-28588 --- .../build.gradle | 1 - ...acheMeterBinderProvidersConfiguration.java | 14 ---- .../spring-boot-actuator/build.gradle | 1 - .../EhCache2CacheMeterBinderProvider.java | 38 --------- ...EhCache2CacheMeterBinderProviderTests.java | 57 ------------- .../spring-boot-autoconfigure/build.gradle | 1 - .../cache/CacheConfigurations.java | 1 - .../autoconfigure/cache/CacheProperties.java | 26 ------ .../boot/autoconfigure/cache/CacheType.java | 5 -- .../cache/EhCacheCacheConfiguration.java | 74 ----------------- .../AbstractCacheAutoConfigurationTests.java | 8 -- .../cache/CacheAutoConfigurationTests.java | 15 ---- .../EhCache2CacheAutoConfigurationTests.java | 81 ------------------- .../spring-boot-dependencies/build.gradle | 7 -- .../src/docs/asciidoc/actuator/metrics.adoc | 1 - .../docs/asciidoc/anchor-rewrite.properties | 2 - .../src/docs/asciidoc/io/caching.adoc | 19 +---- .../spring-boot-smoke-test-cache/build.gradle | 3 - 18 files changed, 1 insertion(+), 353 deletions(-) delete mode 100644 spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProvider.java delete mode 100644 spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProviderTests.java delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/EhCacheCacheConfiguration.java delete mode 100644 spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/EhCache2CacheAutoConfigurationTests.java diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle index 5b4e527779a..844addd09eb 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle @@ -80,7 +80,6 @@ dependencies { optional("jakarta.persistence:jakarta.persistence-api") optional("jakarta.servlet:jakarta.servlet-api") optional("javax.cache:cache-api") - optional("net.sf.ehcache:ehcache") optional("org.apache.activemq:activemq-broker") { exclude group: "org.apache.geronimo.specs", module: "geronimo-jms_1.1_spec" exclude group: "org.apache.geronimo.specs", module: "geronimo-j2ee-management_1.1_spec" diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMeterBinderProvidersConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMeterBinderProvidersConfiguration.java index e756fc201cb..dbe6bd17b70 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMeterBinderProvidersConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/cache/CacheMeterBinderProvidersConfiguration.java @@ -19,17 +19,14 @@ package org.springframework.boot.actuate.autoconfigure.metrics.cache; import com.hazelcast.core.Hazelcast; import com.hazelcast.spring.cache.HazelcastCache; import io.micrometer.core.instrument.binder.MeterBinder; -import net.sf.ehcache.Ehcache; import org.springframework.boot.actuate.metrics.cache.CacheMeterBinderProvider; import org.springframework.boot.actuate.metrics.cache.CaffeineCacheMeterBinderProvider; -import org.springframework.boot.actuate.metrics.cache.EhCache2CacheMeterBinderProvider; import org.springframework.boot.actuate.metrics.cache.HazelcastCacheMeterBinderProvider; import org.springframework.boot.actuate.metrics.cache.JCacheCacheMeterBinderProvider; import org.springframework.boot.actuate.metrics.cache.RedisCacheMeterBinderProvider; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.cache.caffeine.CaffeineCache; -import org.springframework.cache.ehcache.EhCacheCache; import org.springframework.cache.jcache.JCacheCache; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -55,17 +52,6 @@ class CacheMeterBinderProvidersConfiguration { } - @Configuration(proxyBeanMethods = false) - @ConditionalOnClass({ EhCacheCache.class, Ehcache.class }) - static class EhCache2CacheMeterBinderProviderConfiguration { - - @Bean - EhCache2CacheMeterBinderProvider ehCache2CacheMeterBinderProvider() { - return new EhCache2CacheMeterBinderProvider(); - } - - } - @Configuration(proxyBeanMethods = false) @ConditionalOnClass({ HazelcastCache.class, Hazelcast.class }) static class HazelcastCacheMeterBinderProviderConfiguration { diff --git a/spring-boot-project/spring-boot-actuator/build.gradle b/spring-boot-project/spring-boot-actuator/build.gradle index a9a6a5c9bd9..601188b1a4e 100644 --- a/spring-boot-project/spring-boot-actuator/build.gradle +++ b/spring-boot-project/spring-boot-actuator/build.gradle @@ -39,7 +39,6 @@ dependencies { } optional("javax.cache:cache-api") optional("jakarta.jms:jakarta.jms-api") - optional("net.sf.ehcache:ehcache") optional("org.apache.solr:solr-solrj") { exclude group: "org.slf4j", module: "jcl-over-slf4j" } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProvider.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProvider.java deleted file mode 100644 index b848b8f50c9..00000000000 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2012-2019 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.metrics.cache; - -import io.micrometer.core.instrument.Tag; -import io.micrometer.core.instrument.binder.MeterBinder; -import io.micrometer.core.instrument.binder.cache.EhCache2Metrics; - -import org.springframework.cache.ehcache.EhCacheCache; - -/** - * {@link CacheMeterBinderProvider} implementation for EhCache2. - * - * @author Stephane Nicoll - * @since 2.0.0 - */ -public class EhCache2CacheMeterBinderProvider implements CacheMeterBinderProvider { - - @Override - public MeterBinder getMeterBinder(EhCacheCache cache, Iterable tags) { - return new EhCache2Metrics(cache.getNativeCache(), tags); - } - -} diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProviderTests.java deleted file mode 100644 index c67750074a8..00000000000 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProviderTests.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2012-2019 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.metrics.cache; - -import java.util.Collections; - -import io.micrometer.core.instrument.binder.MeterBinder; -import io.micrometer.core.instrument.binder.cache.EhCache2Metrics; -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.config.CacheConfiguration; -import net.sf.ehcache.config.Configuration; -import org.junit.jupiter.api.Test; - -import org.springframework.cache.ehcache.EhCacheCache; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for {@link EhCache2CacheMeterBinderProvider}. - * - * @author Stephane Nicoll - */ -class EhCache2CacheMeterBinderProviderTests { - - @Test - void ehCache2CacheProvider() { - CacheManager cacheManager = new CacheManager( - new Configuration().name("EhCacheCacheTests").defaultCache(new CacheConfiguration("default", 100))); - try { - Cache nativeCache = new Cache(new CacheConfiguration("test", 100)); - cacheManager.addCache(nativeCache); - EhCacheCache cache = new EhCacheCache(nativeCache); - MeterBinder meterBinder = new EhCache2CacheMeterBinderProvider().getMeterBinder(cache, - Collections.emptyList()); - assertThat(meterBinder).isInstanceOf(EhCache2Metrics.class); - } - finally { - cacheManager.shutdown(); - } - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/build.gradle b/spring-boot-project/spring-boot-autoconfigure/build.gradle index 0c84af5666d..72d753e19a0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-autoconfigure/build.gradle @@ -51,7 +51,6 @@ dependencies { optional("jakarta.ws.rs:jakarta.ws.rs-api") optional("javax.cache:cache-api") optional("javax.money:money-api") - optional("net.sf.ehcache:ehcache") optional("org.apache.activemq:activemq-broker") { exclude group: "org.apache.geronimo.specs", module: "geronimo-j2ee-management_1.1_spec" exclude group: "org.apache.geronimo.specs", module: "geronimo-jms_1.1_spec" diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigurations.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigurations.java index 9fe6aacb0fb..c233ff96976 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigurations.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheConfigurations.java @@ -36,7 +36,6 @@ final class CacheConfigurations { static { Map mappings = new EnumMap<>(CacheType.class); mappings.put(CacheType.GENERIC, GenericCacheConfiguration.class.getName()); - mappings.put(CacheType.EHCACHE, EhCacheCacheConfiguration.class.getName()); mappings.put(CacheType.HAZELCAST, HazelcastCacheConfiguration.class.getName()); mappings.put(CacheType.INFINISPAN, InfinispanCacheConfiguration.class.getName()); mappings.put(CacheType.JCACHE, JCacheCacheConfiguration.class.getName()); diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java index d7357245c80..6b7b2a2042e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheProperties.java @@ -50,8 +50,6 @@ public class CacheProperties { private final Couchbase couchbase = new Couchbase(); - private final EhCache ehcache = new EhCache(); - private final Infinispan infinispan = new Infinispan(); private final JCache jcache = new JCache(); @@ -82,10 +80,6 @@ public class CacheProperties { return this.couchbase; } - public EhCache getEhcache() { - return this.ehcache; - } - public Infinispan getInfinispan() { return this.infinispan; } @@ -156,26 +150,6 @@ public class CacheProperties { } - /** - * EhCache specific cache properties. - */ - public static class EhCache { - - /** - * The location of the configuration file to use to initialize EhCache. - */ - private Resource config; - - public Resource getConfig() { - return this.config; - } - - public void setConfig(Resource config) { - this.config = config; - } - - } - /** * Infinispan specific cache properties. */ diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheType.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheType.java index e63eea28e36..f8bf5bbefa9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheType.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheType.java @@ -36,11 +36,6 @@ public enum CacheType { */ JCACHE, - /** - * EhCache backed caching. - */ - EHCACHE, - /** * Hazelcast backed caching. */ diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/EhCacheCacheConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/EhCacheCacheConfiguration.java deleted file mode 100644 index 619c79f2e27..00000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/EhCacheCacheConfiguration.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2012-2019 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.autoconfigure.cache; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; - -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.condition.ResourceCondition; -import org.springframework.cache.ehcache.EhCacheCacheManager; -import org.springframework.cache.ehcache.EhCacheManagerUtils; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Conditional; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.io.Resource; - -/** - * EhCache cache configuration. Only kick in if a configuration file location is set or if - * a default configuration file exists. - * - * @author EddĂș MelĂ©ndez - * @author Stephane Nicoll - * @author Madhura Bhave - */ -@Configuration(proxyBeanMethods = false) -@ConditionalOnClass({ Cache.class, EhCacheCacheManager.class }) -@ConditionalOnMissingBean(org.springframework.cache.CacheManager.class) -@Conditional({ CacheCondition.class, EhCacheCacheConfiguration.ConfigAvailableCondition.class }) -class EhCacheCacheConfiguration { - - @Bean - EhCacheCacheManager cacheManager(CacheManagerCustomizers customizers, CacheManager ehCacheCacheManager) { - return customizers.customize(new EhCacheCacheManager(ehCacheCacheManager)); - } - - @Bean - @ConditionalOnMissingBean - CacheManager ehCacheCacheManager(CacheProperties cacheProperties) { - Resource location = cacheProperties.resolveConfigLocation(cacheProperties.getEhcache().getConfig()); - if (location != null) { - return EhCacheManagerUtils.buildCacheManager(location); - } - return EhCacheManagerUtils.buildCacheManager(); - } - - /** - * Determine if the EhCache configuration is available. This either kick in if a - * default configuration has been found or if property referring to the file to use - * has been set. - */ - static class ConfigAvailableCondition extends ResourceCondition { - - ConfigAvailableCondition() { - super("EhCache", "spring.cache.ehcache.config", "classpath:/ehcache.xml"); - } - - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/AbstractCacheAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/AbstractCacheAutoConfigurationTests.java index b6f85a57184..f8a6d3df34e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/AbstractCacheAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/AbstractCacheAutoConfigurationTests.java @@ -31,7 +31,6 @@ import org.springframework.boot.test.context.runner.ContextConsumer; import org.springframework.cache.CacheManager; import org.springframework.cache.caffeine.CaffeineCacheManager; import org.springframework.cache.concurrent.ConcurrentMapCacheManager; -import org.springframework.cache.ehcache.EhCacheCacheManager; import org.springframework.cache.support.SimpleCacheManager; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -114,13 +113,6 @@ abstract class AbstractCacheAutoConfigurationTests { }; } - @Bean - CacheManagerCustomizer ehcacheCacheManagerCustomizer() { - return new CacheManagerTestCustomizer() { - - }; - } - @Bean CacheManagerCustomizer hazelcastCacheManagerCustomizer() { return new CacheManagerTestCustomizer() { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java index 1550285c865..1d2fe4cb6f2 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfigurationTests.java @@ -32,7 +32,6 @@ import com.hazelcast.cache.impl.HazelcastServerCachingProvider; import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.spring.cache.HazelcastCacheManager; -import net.sf.ehcache.Status; import org.infinispan.configuration.cache.ConfigurationBuilder; import org.infinispan.jcache.embedded.JCachingProvider; import org.infinispan.spring.embedded.provider.SpringEmbeddedCacheManager; @@ -837,20 +836,6 @@ class CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @EnableCaching - static class EhCacheCustomCacheManager { - - @Bean - net.sf.ehcache.CacheManager customEhCacheCacheManager() { - net.sf.ehcache.CacheManager cacheManager = mock(net.sf.ehcache.CacheManager.class); - given(cacheManager.getStatus()).willReturn(Status.STATUS_ALIVE); - given(cacheManager.getCacheNames()).willReturn(new String[0]); - return cacheManager; - } - - } - @Configuration(proxyBeanMethods = false) @EnableCaching static class HazelcastCustomHazelcastInstance { diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/EhCache2CacheAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/EhCache2CacheAutoConfigurationTests.java deleted file mode 100644 index 25cf51d3364..00000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/cache/EhCache2CacheAutoConfigurationTests.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2012-2019 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. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.autoconfigure.cache; - -import org.junit.jupiter.api.Test; - -import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.autoconfigure.cache.CacheAutoConfigurationTests.DefaultCacheAndCustomizersConfiguration; -import org.springframework.boot.autoconfigure.cache.CacheAutoConfigurationTests.DefaultCacheConfiguration; -import org.springframework.boot.autoconfigure.cache.CacheAutoConfigurationTests.EhCacheCustomCacheManager; -import org.springframework.boot.test.context.runner.ApplicationContextRunner; -import org.springframework.boot.testsupport.classpath.ClassPathExclusions; -import org.springframework.cache.ehcache.EhCacheCacheManager; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for {@link CacheAutoConfiguration} with EhCache 2. - * - * @author Stephane Nicoll - * @author Andy Wilkinson - */ -@ClassPathExclusions("ehcache-3*.jar") -class EhCache2CacheAutoConfigurationTests extends AbstractCacheAutoConfigurationTests { - - private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(CacheAutoConfiguration.class)); - - @Test - void ehCacheWithCaches() { - this.contextRunner.withUserConfiguration(DefaultCacheConfiguration.class) - .withPropertyValues("spring.cache.type=ehcache").run((context) -> { - EhCacheCacheManager cacheManager = getCacheManager(context, EhCacheCacheManager.class); - assertThat(cacheManager.getCacheNames()).containsOnly("cacheTest1", "cacheTest2"); - assertThat(context.getBean(net.sf.ehcache.CacheManager.class)) - .isEqualTo(cacheManager.getCacheManager()); - }); - } - - @Test - void ehCacheWithCustomizers() { - this.contextRunner.withUserConfiguration(DefaultCacheAndCustomizersConfiguration.class) - .withPropertyValues("spring.cache.type=ehcache") - .run(verifyCustomizers("allCacheManagerCustomizer", "ehcacheCacheManagerCustomizer")); - } - - @Test - void ehCacheWithConfig() { - this.contextRunner.withUserConfiguration(DefaultCacheConfiguration.class) - .withPropertyValues("spring.cache.type=ehcache", - "spring.cache.ehcache.config=cache/ehcache-override.xml") - .run((context) -> { - EhCacheCacheManager cacheManager = getCacheManager(context, EhCacheCacheManager.class); - assertThat(cacheManager.getCacheNames()).containsOnly("cacheOverrideTest1", "cacheOverrideTest2"); - }); - } - - @Test - void ehCacheWithExistingCacheManager() { - this.contextRunner.withUserConfiguration(EhCacheCustomCacheManager.class) - .withPropertyValues("spring.cache.type=ehcache").run((context) -> { - EhCacheCacheManager cacheManager = getCacheManager(context, EhCacheCacheManager.class); - assertThat(cacheManager.getCacheManager()).isEqualTo(context.getBean("customEhCacheCacheManager")); - }); - } - -} diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index b5ff022b564..7d74611e294 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -257,13 +257,6 @@ bom { ] } } - library("Ehcache", "2.10.9.2") { - group("net.sf.ehcache") { - modules = [ - "ehcache" - ] - } - } library("Ehcache3", "3.9.7") { group("org.ehcache") { modules = [ diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/metrics.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/metrics.adoc index 0c86b2560e7..f0efd55e197 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/metrics.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/actuator/metrics.adoc @@ -860,7 +860,6 @@ Additional, cache-specific metrics are also available. The following cache libraries are supported: * Caffeine -* EhCache 2 * Hazelcast * Any compliant JCache (JSR-107) implementation * Redis diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/anchor-rewrite.properties b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/anchor-rewrite.properties index d91405888ca..a697faa4f06 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/anchor-rewrite.properties +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/anchor-rewrite.properties @@ -277,7 +277,6 @@ boot-features-caching=features.caching boot-features-caching-provider=features.caching.provider boot-features-caching-provider-generic=features.caching.provider.generic boot-features-caching-provider-jcache=features.caching.provider.jcache -boot-features-caching-provider-ehcache2=features.caching.provider.ehcache2 boot-features-caching-provider-hazelcast=features.caching.provider.hazelcast boot-features-caching-provider-infinispan=features.caching.provider.infinispan boot-features-caching-provider-couchbase=features.caching.provider.couchbase @@ -784,7 +783,6 @@ features.caching=io.caching features.caching.provider=io.caching.provider features.caching.provider.generic=io.caching.provider.generic features.caching.provider.jcache=io.caching.provider.jcache -features.caching.provider.ehcache2=io.caching.provider.ehcache2 features.caching.provider.hazelcast=io.caching.provider.hazelcast features.caching.provider.infinispan=io.caching.provider.infinispan features.caching.provider.couchbase=io.caching.provider.couchbase diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/io/caching.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/io/caching.adoc index dba2c44d5ec..cd3e1bb1be3 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/io/caching.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/io/caching.adoc @@ -41,7 +41,6 @@ If you have not defined a bean of type `CacheManager` or a `CacheResolver` named . <> . <> (EhCache 3, Hazelcast, Infinispan, and others) -. <> . <> . <> . <> @@ -54,7 +53,7 @@ Use this property if you need to <>. diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-cache/build.gradle b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-cache/build.gradle index 84e14c23b1f..37a471ccab8 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-cache/build.gradle +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-cache/build.gradle @@ -16,9 +16,6 @@ def caches = [ "javax.cache:cache-api", "org.ehcache:ehcache" ], - "ehcache2": [ - "net.sf.ehcache:ehcache" - ], "hazelcast": [ "com.hazelcast:hazelcast", "com.hazelcast:hazelcast-spring"