Skip to content

Commit 3ea272a

Browse files
committed
Rewrite 2nd level cache to use ehcache
Closes gh-44809
1 parent 9091f3f commit 3ea272a

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

Diff for: spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/Hibernate2ndLevelCacheIntegrationTests.java

+4-22
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616

1717
package org.springframework.boot.autoconfigure.orm.jpa;
1818

19-
import com.hazelcast.cache.impl.HazelcastServerCachingProvider;
19+
import org.ehcache.jsr107.EhcacheCachingProvider;
2020
import org.junit.jupiter.api.Test;
2121

2222
import org.springframework.boot.autoconfigure.AutoConfigurations;
2323
import org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration;
2424
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
2525
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
26-
import org.springframework.boot.testsupport.classpath.resources.WithResource;
2726
import org.springframework.cache.annotation.EnableCaching;
2827
import org.springframework.context.annotation.Configuration;
2928

@@ -42,29 +41,12 @@ class Hibernate2ndLevelCacheIntegrationTests {
4241
.withUserConfiguration(TestConfiguration.class);
4342

4443
@Test
45-
@WithResource(name = "hazelcast.xml", content = """
46-
<hazelcast
47-
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-5.0.xsd"
48-
xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
49-
<instance-name>default-instance</instance-name>
50-
<map name="defaultCache" />
51-
<network>
52-
<join>
53-
<auto-detection enabled="false" />
54-
<multicast enabled="false" />
55-
</join>
56-
</network>
57-
</hazelcast>
58-
""")
59-
void hibernate2ndLevelCacheWithJCacheAndHazelcast() {
60-
String cachingProviderFqn = HazelcastServerCachingProvider.class.getName();
61-
String configLocation = "classpath:hazelcast.xml";
44+
void hibernate2ndLevelCacheWithJCacheAndEhCache() {
45+
String cachingProviderFqn = EhcacheCachingProvider.class.getName();
6246
this.contextRunner
6347
.withPropertyValues("spring.cache.type=jcache", "spring.cache.jcache.provider=" + cachingProviderFqn,
64-
"spring.cache.jcache.config=" + configLocation,
6548
"spring.jpa.properties.hibernate.cache.region.factory_class=jcache",
66-
"spring.jpa.properties.hibernate.cache.provider=" + cachingProviderFqn,
67-
"spring.jpa.properties.hibernate.javax.cache.uri=" + configLocation)
49+
"spring.jpa.properties.hibernate.cache.provider=" + cachingProviderFqn)
6850
.run((context) -> assertThat(context).hasNotFailed());
6951
}
7052

0 commit comments

Comments
 (0)