diff --git a/build.gradle b/build.gradle index 4cef73ac42..bf53b9381f 100644 --- a/build.gradle +++ b/build.gradle @@ -77,6 +77,7 @@ configure(allprojects) { project -> maven { url "https://repository.apache.org/content/repositories/releases" } // tomcat 8 RC3 maven { url "https://repository.apache.org/content/repositories/snapshots" } // tomcat-websocket-* snapshots maven { url "https://maven.java.net/content/repositories/releases" } // javax.websocket, tyrus + maven { url "https://oss.sonatype.org/content/repositories/snapshots" } // javax.cache } dependencies { @@ -349,7 +350,7 @@ project("spring-context") { compile(files(project(":spring-core").cglibRepackJar)) optional("javax.ejb:ejb-api:3.0") optional("javax.inject:javax.inject:1") - optional("javax.enterprise.concurrent:javax.enterprise.concurrent-api:1.0-b06") + optional("javax.enterprise.concurrent:javax.enterprise.concurrent-api:1.0") optional("org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.1") optional("org.eclipse.persistence:javax.persistence:2.0.0") optional("org.beanshell:bsh:2.0b4") @@ -419,7 +420,7 @@ project("spring-tx") { compile("aopalliance:aopalliance:1.0") provided("com.ibm.websphere:uow:6.0.2.17") optional("javax.resource:connector-api:1.5") - optional("javax.transaction:javax.transaction-api:1.2-b03") + optional("javax.transaction:javax.transaction-api:1.2") optional("javax.ejb:ejb-api:3.0") testCompile("org.eclipse.persistence:javax.persistence:2.0.0") testCompile("org.aspectj:aspectjweaver:${aspectjVersion}") @@ -505,7 +506,7 @@ project("spring-context-support") { optional(project(":spring-jdbc")) // for Quartz support optional(project(":spring-tx")) // for Quartz support optional("javax.mail:mail:1.4.7") - optional("javax.cache:cache-api:0.6") + optional("javax.cache:cache-api:0.11-SNAPSHOT") optional("net.sf.ehcache:ehcache-core:2.6.5") optional("org.quartz-scheduler:quartz:1.8.6") { exclude group: "org.slf4j", module: "slf4j-log4j12" diff --git a/spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCache.java b/spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCache.java index 8b0a731c4e..536f9fc20b 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCache.java +++ b/spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -18,8 +18,6 @@ package org.springframework.cache.jcache; import java.io.Serializable; -import javax.cache.Status; - import org.springframework.cache.Cache; import org.springframework.cache.support.SimpleValueWrapper; import org.springframework.util.Assert; @@ -28,6 +26,8 @@ import org.springframework.util.Assert; * {@link org.springframework.cache.Cache} implementation on top of a * {@link javax.cache.Cache} instance. * + *
Note: This class has been updated for JCache 0.11, as of Spring 4.0. + * * @author Juergen Hoeller * @since 3.2 */ @@ -56,9 +56,6 @@ public class JCacheCache implements Cache { */ public JCacheCache(javax.cache.Cache,?> jcache, boolean allowNullValues) { Assert.notNull(jcache, "Cache must not be null"); - Status status = jcache.getStatus(); - Assert.isTrue(Status.STARTED.equals(status), - "A 'started' cache is required - current cache is " + status.toString()); this.cache = jcache; this.allowNullValues = allowNullValues; } diff --git a/spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCacheManager.java b/spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCacheManager.java index e06d8492d2..6e3b30e458 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCacheManager.java +++ b/spring-context-support/src/main/java/org/springframework/cache/jcache/JCacheCacheManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -19,16 +19,17 @@ package org.springframework.cache.jcache; import java.util.Collection; import java.util.LinkedHashSet; import javax.cache.CacheManager; -import javax.cache.Status; +import javax.cache.Caching; import org.springframework.cache.Cache; import org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager; -import org.springframework.util.Assert; /** * {@link org.springframework.cache.CacheManager} implementation * backed by a JCache {@link javax.cache.CacheManager}. * + *
Note: This class has been updated for JCache 0.11, as of Spring 4.0.
+ *
* @author Juergen Hoeller
* @since 3.2
*/
@@ -87,16 +88,20 @@ public class JCacheCacheManager extends AbstractTransactionSupportingCacheManage
return this.allowNullValues;
}
+ @Override
+ public void afterPropertiesSet() {
+ if (this.cacheManager == null) {
+ this.cacheManager = Caching.getCachingProvider().getCacheManager();
+ }
+ super.afterPropertiesSet();
+ }
+
@Override
protected Collection Note: This class has been updated for JCache 0.11, as of Spring 4.0.
+ *
* @author Juergen Hoeller
* @since 3.2
- * @see javax.cache.Caching#getCacheManager()
- * @see javax.cache.Caching#getCacheManager(String)
+ * @see javax.cache.Caching#getCachingProvider()
+ * @see javax.cache.spi.CachingProvider#getCacheManager()
*/
public class JCacheManagerFactoryBean
implements FactoryBean