Cache provider related exceptions handling

This commit adds the necessary infrastructure to handle exceptions
thrown by a cache provider in both Spring's and JCache's caching
abstractions.

Both interceptors can be configured with a CacheErrorHandler that
defines several callbacks on typical cache operations. In particular,
handleCacheGetError can be implemented in such a way that an
exception thrown by the provider is handled as a cache miss by the
caching abstraction.

The handler can be configured with both CachingConfigurer and the
XML namespace (error-handler property)

Issue: SPR-9275
This commit is contained in:
Stephane Nicoll
2014-05-20 10:02:27 +02:00
parent c7d1c49d6d
commit 05e96ee448
30 changed files with 1158 additions and 32 deletions

View File

@@ -7,7 +7,7 @@
http://www.springframework.org/schema/cache
http://www.springframework.org/schema/cache/spring-cache.xsd">
<cache:annotation-driven proxy-target-class="false" order="0"/>
<cache:annotation-driven proxy-target-class="false" order="0" error-handler="errorHandler"/>
<bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
<property name="caches">
@@ -26,6 +26,8 @@
</property>
</bean>
<bean id="errorHandler" class="org.springframework.cache.interceptor.SimpleCacheErrorHandler"/>
<bean id="defaultCache"
class="org.springframework.cache.concurrent.ConcurrentMapCacheFactoryBean">
<property name="name" value="default"/>