From 3ea272ac2a6eea43b49c0767920557d12a8289a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Thu, 20 Mar 2025 15:50:56 +0100 Subject: [PATCH] Rewrite 2nd level cache to use ehcache Closes gh-44809 --- ...ibernate2ndLevelCacheIntegrationTests.java | 26 +++---------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/Hibernate2ndLevelCacheIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/Hibernate2ndLevelCacheIntegrationTests.java index 274c373e0fc..9696efcd87e 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/Hibernate2ndLevelCacheIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/Hibernate2ndLevelCacheIntegrationTests.java @@ -16,14 +16,13 @@ package org.springframework.boot.autoconfigure.orm.jpa; -import com.hazelcast.cache.impl.HazelcastServerCachingProvider; +import org.ehcache.jsr107.EhcacheCachingProvider; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.test.context.runner.ApplicationContextRunner; -import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Configuration; @@ -42,29 +41,12 @@ class Hibernate2ndLevelCacheIntegrationTests { .withUserConfiguration(TestConfiguration.class); @Test - @WithResource(name = "hazelcast.xml", content = """ - - default-instance - - - - - - - - - """) - void hibernate2ndLevelCacheWithJCacheAndHazelcast() { - String cachingProviderFqn = HazelcastServerCachingProvider.class.getName(); - String configLocation = "classpath:hazelcast.xml"; + void hibernate2ndLevelCacheWithJCacheAndEhCache() { + String cachingProviderFqn = EhcacheCachingProvider.class.getName(); this.contextRunner .withPropertyValues("spring.cache.type=jcache", "spring.cache.jcache.provider=" + cachingProviderFqn, - "spring.cache.jcache.config=" + configLocation, "spring.jpa.properties.hibernate.cache.region.factory_class=jcache", - "spring.jpa.properties.hibernate.cache.provider=" + cachingProviderFqn, - "spring.jpa.properties.hibernate.javax.cache.uri=" + configLocation) + "spring.jpa.properties.hibernate.cache.provider=" + cachingProviderFqn) .run((context) -> assertThat(context).hasNotFailed()); }