001/*
002 * Copyright 2002-2014 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.cache.jcache.config;
018
019import org.springframework.cache.annotation.CachingConfigurer;
020import org.springframework.cache.interceptor.CacheResolver;
021
022/**
023 * Extension of {@link CachingConfigurer} for the JSR-107 implementation.
024 *
025 * <p>To be implemented by classes annotated with
026 * {@link org.springframework.cache.annotation.EnableCaching} that wish
027 * or need to specify explicitly how exception caches are resolved for
028 * annotation-driven cache management. Consider extending {@link JCacheConfigurerSupport},
029 * which provides a stub implementation of all interface methods.
030 *
031 * <p>See {@link org.springframework.cache.annotation.EnableCaching} for
032 * general examples and context; see {@link #exceptionCacheResolver()} for
033 * detailed instructions.
034 *
035 * @author Stephane Nicoll
036 * @since 4.1
037 * @see CachingConfigurer
038 * @see JCacheConfigurerSupport
039 * @see org.springframework.cache.annotation.EnableCaching
040 */
041public interface JCacheConfigurer extends CachingConfigurer {
042
043        /**
044         * Return the {@link CacheResolver} bean to use to resolve exception caches for
045         * annotation-driven cache management. Implementations must explicitly declare
046         * {@link org.springframework.context.annotation.Bean @Bean}, e.g.
047         * <pre class="code">
048         * &#064;Configuration
049         * &#064;EnableCaching
050         * public class AppConfig extends JCacheConfigurerSupport {
051         *     &#064;Bean // important!
052         *     &#064;Override
053         *     public CacheResolver exceptionCacheResolver() {
054         *         // configure and return CacheResolver instance
055         *     }
056         *     // ...
057         * }
058         * </pre>
059         * See {@link org.springframework.cache.annotation.EnableCaching} for more complete examples.
060         */
061        CacheResolver exceptionCacheResolver();
062
063}