Compatibility with EhCache 3.0 M1 (as a JCache provider)

Issue: SPR-12847
This commit is contained in:
Juergen Hoeller 2015-03-24 19:20:26 +01:00
parent 09027f7972
commit 26d4f91835
3 changed files with 13 additions and 8 deletions

View File

@ -33,7 +33,7 @@ configure(allprojects) { project ->
ext.ehcachejcacheVersion = "1.0.1"
ext.fileuploadVersion = "1.3.1"
ext.freemarkerVersion = "2.3.22"
ext.groovyVersion = "2.4.2"
ext.groovyVersion = "2.4.3"
ext.gsonVersion = "2.3.1"
ext.hibernate3Version = "3.6.10.Final"
ext.hibernate4Version = "4.3.8.Final"
@ -647,8 +647,9 @@ project("spring-context-support") {
testCompile("commons-digester:commons-digester:1.8.1") // for Velocity/JasperReports
testCompile("org.hsqldb:hsqldb:${hsqldbVersion}")
testCompile("org.slf4j:slf4j-api:${slf4jVersion}")
testCompile("org.ehcache:jcache:${ehcachejcacheVersion}")
testRuntime("com.sun.mail:javax.mail:1.5.2")
testCompile("org.ehcache:jcache:${ehcachejcacheVersion}")
// testCompile("org.ehcache:ehcache:3.0.0.m1") // alternative to ehcache-jcache above
}
}

View File

@ -1,7 +1,12 @@
/**
* Support classes for the open source cache
* <a href="http://ehcache.sourceforge.net">EhCache</a>,
* <a href="http://ehcache.sourceforge.net">EhCache 2.x</a>,
* allowing to set up an EhCache CacheManager and Caches
* as beans in a Spring context.
*
* <p>Note: EhCache 3.x lives in a different package namespace
* and is not covered by the traditional support classes here.
* Instead, consider using it through JCache (JSR-107), with
* Spring's support in {@link org.springframework.cache.jcache}.
*/
package org.springframework.cache.ehcache;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,7 +20,6 @@ import javax.cache.CacheManager;
import javax.cache.Caching;
import javax.cache.configuration.MutableConfiguration;
import org.ehcache.jcache.JCacheConfiguration;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;
@ -82,9 +81,9 @@ public class JCacheEhCacheTests extends AbstractAnnotationTests {
CacheManager cacheManager = Caching.getCachingProvider().getCacheManager();
MutableConfiguration<Object, Object> mutableConfiguration = new MutableConfiguration<Object, Object>();
mutableConfiguration.setStoreByValue(false); // otherwise value has to be Serializable
cacheManager.createCache("testCache", new JCacheConfiguration<Object, Object>(mutableConfiguration));
cacheManager.createCache("primary", new JCacheConfiguration<Object, Object>(mutableConfiguration));
cacheManager.createCache("secondary", new JCacheConfiguration<Object, Object>(mutableConfiguration));
cacheManager.createCache("testCache", mutableConfiguration);
cacheManager.createCache("primary", mutableConfiguration);
cacheManager.createCache("secondary", mutableConfiguration);
return cacheManager;
}