diff --git a/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheCacheManager.java b/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheCacheManager.java index 80ca887b9c..316ff15d09 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheCacheManager.java +++ b/spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheCacheManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 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. @@ -46,7 +46,7 @@ public class EhCacheCacheManager extends AbstractTransactionSupportingCacheManag } /** - * Create a new EhCacheCacheManager for the given backing EhCache. + * Create a new EhCacheCacheManager for the given backing EhCache CacheManager. * @param cacheManager the backing EhCache {@link net.sf.ehcache.CacheManager} */ public EhCacheCacheManager(net.sf.ehcache.CacheManager cacheManager) { @@ -92,8 +92,8 @@ public class EhCacheCacheManager extends AbstractTransactionSupportingCacheManag // (in case the cache was added at runtime) Ehcache ehcache = this.cacheManager.getEhcache(name); if (ehcache != null) { - cache = new EhCacheCache(ehcache); - addCache(cache); + addCache(new EhCacheCache(ehcache)); + cache = super.getCache(name); // potentially decorated } } return cache; 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..181b9bf7c8 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-2014 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. @@ -110,8 +110,8 @@ public class JCacheCacheManager extends AbstractTransactionSupportingCacheManage // (in case the cache was added at runtime) javax.cache.Cache jcache = this.cacheManager.getCache(name); if (jcache != null) { - cache = new JCacheCache(jcache, this.allowNullValues); - addCache(cache); + addCache(new JCacheCache(jcache, this.allowNullValues)); + cache = super.getCache(name); // potentially decorated } } return cache;