Skip to content

Commit 26d4f91

Browse files
committed
Compatibility with EhCache 3.0 M1 (as a JCache provider)
Issue: SPR-12847
1 parent 09027f7 commit 26d4f91

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ configure(allprojects) { project ->
3333
ext.ehcachejcacheVersion = "1.0.1"
3434
ext.fileuploadVersion = "1.3.1"
3535
ext.freemarkerVersion = "2.3.22"
36-
ext.groovyVersion = "2.4.2"
36+
ext.groovyVersion = "2.4.3"
3737
ext.gsonVersion = "2.3.1"
3838
ext.hibernate3Version = "3.6.10.Final"
3939
ext.hibernate4Version = "4.3.8.Final"
@@ -647,8 +647,9 @@ project("spring-context-support") {
647647
testCompile("commons-digester:commons-digester:1.8.1") // for Velocity/JasperReports
648648
testCompile("org.hsqldb:hsqldb:${hsqldbVersion}")
649649
testCompile("org.slf4j:slf4j-api:${slf4jVersion}")
650-
testCompile("org.ehcache:jcache:${ehcachejcacheVersion}")
651650
testRuntime("com.sun.mail:javax.mail:1.5.2")
651+
testCompile("org.ehcache:jcache:${ehcachejcacheVersion}")
652+
// testCompile("org.ehcache:ehcache:3.0.0.m1") // alternative to ehcache-jcache above
652653
}
653654
}
654655

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
/**
22
* Support classes for the open source cache
3-
* <a href="http://ehcache.sourceforge.net">EhCache</a>,
3+
* <a href="http://ehcache.sourceforge.net">EhCache 2.x</a>,
44
* allowing to set up an EhCache CacheManager and Caches
55
* as beans in a Spring context.
6+
*
7+
* <p>Note: EhCache 3.x lives in a different package namespace
8+
* and is not covered by the traditional support classes here.
9+
* Instead, consider using it through JCache (JSR-107), with
10+
* Spring's support in {@link org.springframework.cache.jcache}.
611
*/
712
package org.springframework.cache.ehcache;

spring-context-support/src/test/java/org/springframework/cache/jcache/JCacheEhCacheTests.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@
2020
import javax.cache.Caching;
2121
import javax.cache.configuration.MutableConfiguration;
2222

23-
import org.ehcache.jcache.JCacheConfiguration;
2423
import org.junit.After;
2524
import org.junit.Ignore;
2625
import org.junit.Test;
@@ -82,9 +81,9 @@ public CacheManager jCacheManager() {
8281
CacheManager cacheManager = Caching.getCachingProvider().getCacheManager();
8382
MutableConfiguration<Object, Object> mutableConfiguration = new MutableConfiguration<Object, Object>();
8483
mutableConfiguration.setStoreByValue(false); // otherwise value has to be Serializable
85-
cacheManager.createCache("testCache", new JCacheConfiguration<Object, Object>(mutableConfiguration));
86-
cacheManager.createCache("primary", new JCacheConfiguration<Object, Object>(mutableConfiguration));
87-
cacheManager.createCache("secondary", new JCacheConfiguration<Object, Object>(mutableConfiguration));
84+
cacheManager.createCache("testCache", mutableConfiguration);
85+
cacheManager.createCache("primary", mutableConfiguration);
86+
cacheManager.createCache("secondary", mutableConfiguration);
8887
return cacheManager;
8988
}
9089

0 commit comments

Comments
 (0)