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,8 @@
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
<cache:annotation-driven proxy-target-class="false" order="0" key-generator="keyGenerator"/>
<cache:annotation-driven proxy-target-class="false" order="0"
key-generator="keyGenerator" error-handler="errorHandler"/>
<aop:config>
<aop:advisor advice-ref="debugInterceptor" pointcut="execution(* *..CacheableService.*(..))" order="1"/>
@@ -31,6 +32,8 @@
<bean id="keyGenerator" class="org.springframework.cache.config.SomeKeyGenerator"/>
<bean id="errorHandler" class="org.springframework.cache.interceptor.SimpleCacheErrorHandler"/>
<bean id="customKeyGenerator" class="org.springframework.cache.config.SomeCustomKeyGenerator"/>
<bean id="customCacheManager" class="org.springframework.cache.support.SimpleCacheManager">