1
1
/*
2
- * Copyright 2002-2023 the original author or authors.
2
+ * Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
29
29
* cache management.
30
30
*
31
31
* <p>See @{@link EnableCaching} for general examples and context; see
32
- * {@link #cacheManager()}, {@link #cacheResolver()} and {@link #keyGenerator()}
33
- * for detailed instructions.
32
+ * {@link #cacheManager()}, {@link #cacheResolver()}, {@link #keyGenerator()}, and
33
+ * {@link #errorHandler()} for detailed instructions.
34
34
*
35
35
* @author Chris Beams
36
36
* @author Stephane Nicoll
@@ -46,14 +46,15 @@ public interface CachingConfigurer {
46
46
* management of the cache resolution, consider setting the
47
47
* {@link CacheResolver} directly.
48
48
* <p>Implementations must explicitly declare
49
- * {@link org.springframework.context.annotation.Bean @Bean}, e.g.
49
+ * {@link org.springframework.context.annotation.Bean @Bean} so that
50
+ * the cache manager participates in the lifecycle of the context, e.g.
50
51
* <pre class="code">
51
52
* @Configuration
52
53
* @EnableCaching
53
- * public class AppConfig implements CachingConfigurer {
54
+ * class AppConfig implements CachingConfigurer {
54
55
* @Bean // important!
55
56
* @Override
56
- * public CacheManager cacheManager() {
57
+ * CacheManager cacheManager() {
57
58
* // configure and return CacheManager instance
58
59
* }
59
60
* // ...
@@ -70,17 +71,18 @@ default CacheManager cacheManager() {
70
71
* Return the {@link CacheResolver} bean to use to resolve regular caches for
71
72
* annotation-driven cache management. This is an alternative and more powerful
72
73
* option of specifying the {@link CacheManager} to use.
73
- * <p>If both a {@link #cacheManager()} and {@code # cacheResolver()} are set,
74
+ * <p>If both a {@link #cacheManager()} and {@code cacheResolver()} are set,
74
75
* the cache manager is ignored.
75
76
* <p>Implementations must explicitly declare
76
- * {@link org.springframework.context.annotation.Bean @Bean}, e.g.
77
+ * {@link org.springframework.context.annotation.Bean @Bean} so that
78
+ * the cache resolver participates in the lifecycle of the context, e.g.
77
79
* <pre class="code">
78
80
* @Configuration
79
81
* @EnableCaching
80
- * public class AppConfig implements CachingConfigurer {
82
+ * class AppConfig implements CachingConfigurer {
81
83
* @Bean // important!
82
84
* @Override
83
- * public CacheResolver cacheResolver() {
85
+ * CacheResolver cacheResolver() {
84
86
* // configure and return CacheResolver instance
85
87
* }
86
88
* // ...
@@ -95,20 +97,8 @@ default CacheResolver cacheResolver() {
95
97
96
98
/**
97
99
* Return the key generator bean to use for annotation-driven cache management.
98
- * Implementations must explicitly declare
99
- * {@link org.springframework.context.annotation.Bean @Bean}, e.g.
100
- * <pre class="code">
101
- * @Configuration
102
- * @EnableCaching
103
- * public class AppConfig implements CachingConfigurer {
104
- * @Bean // important!
105
- * @Override
106
- * public KeyGenerator keyGenerator() {
107
- * // configure and return KeyGenerator instance
108
- * }
109
- * // ...
110
- * }
111
- * </pre>
100
+ * <p>By default, {@link org.springframework.cache.interceptor.SimpleKeyGenerator}
101
+ * is used.
112
102
* See @{@link EnableCaching} for more complete examples.
113
103
*/
114
104
@ Nullable
@@ -118,22 +108,8 @@ default KeyGenerator keyGenerator() {
118
108
119
109
/**
120
110
* Return the {@link CacheErrorHandler} to use to handle cache-related errors.
121
- * <p>By default,{@link org.springframework.cache.interceptor.SimpleCacheErrorHandler}
122
- * is used and simply throws the exception back at the client.
123
- * <p>Implementations must explicitly declare
124
- * {@link org.springframework.context.annotation.Bean @Bean}, e.g.
125
- * <pre class="code">
126
- * @Configuration
127
- * @EnableCaching
128
- * public class AppConfig implements CachingConfigurer {
129
- * @Bean // important!
130
- * @Override
131
- * public CacheErrorHandler errorHandler() {
132
- * // configure and return CacheErrorHandler instance
133
- * }
134
- * // ...
135
- * }
136
- * </pre>
111
+ * <p>By default, {@link org.springframework.cache.interceptor.SimpleCacheErrorHandler}
112
+ * is used, which throws the exception back at the client.
137
113
* See @{@link EnableCaching} for more complete examples.
138
114
*/
139
115
@ Nullable
0 commit comments