16
16
17
17
package org .springframework .boot .autoconfigure .orm .jpa ;
18
18
19
- import com . hazelcast . cache . impl . HazelcastServerCachingProvider ;
19
+ import org . ehcache . jsr107 . EhcacheCachingProvider ;
20
20
import org .junit .jupiter .api .Test ;
21
21
22
22
import org .springframework .boot .autoconfigure .AutoConfigurations ;
23
23
import org .springframework .boot .autoconfigure .cache .CacheAutoConfiguration ;
24
24
import org .springframework .boot .autoconfigure .jdbc .DataSourceAutoConfiguration ;
25
25
import org .springframework .boot .test .context .runner .ApplicationContextRunner ;
26
- import org .springframework .boot .testsupport .classpath .resources .WithResource ;
27
26
import org .springframework .cache .annotation .EnableCaching ;
28
27
import org .springframework .context .annotation .Configuration ;
29
28
@@ -42,29 +41,12 @@ class Hibernate2ndLevelCacheIntegrationTests {
42
41
.withUserConfiguration (TestConfiguration .class );
43
42
44
43
@ 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 ();
62
46
this .contextRunner
63
47
.withPropertyValues ("spring.cache.type=jcache" , "spring.cache.jcache.provider=" + cachingProviderFqn ,
64
- "spring.cache.jcache.config=" + configLocation ,
65
48
"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 )
68
50
.run ((context ) -> assertThat (context ).hasNotFailed ());
69
51
}
70
52
0 commit comments