1616
1717package org .springframework .boot .autoconfigure .orm .jpa ;
1818
19- import com . hazelcast . cache . impl . HazelcastServerCachingProvider ;
19+ import org . ehcache . jsr107 . EhcacheCachingProvider ;
2020import org .junit .jupiter .api .Test ;
2121
2222import org .springframework .boot .autoconfigure .AutoConfigurations ;
2323import org .springframework .boot .autoconfigure .cache .CacheAutoConfiguration ;
2424import org .springframework .boot .autoconfigure .jdbc .DataSourceAutoConfiguration ;
2525import org .springframework .boot .test .context .runner .ApplicationContextRunner ;
26- import org .springframework .boot .testsupport .classpath .resources .WithResource ;
2726import org .springframework .cache .annotation .EnableCaching ;
2827import 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