Skip to content

Commit 1f2c6c3

Browse files
committed
Merge branch '6.1.x'
2 parents 7c13d55 + 46ba13b commit 1f2c6c3

File tree

8 files changed

+32
-58
lines changed

8 files changed

+32
-58
lines changed

framework-docs/src/main/java/org/springframework/docs/integration/cache/cacheannotationenable/CacheConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// tag::snippet[]
2626
@Configuration
2727
@EnableCaching
28-
public class CacheConfiguration {
28+
class CacheConfiguration {
2929

3030
@Bean
3131
CacheManager cacheManager() {

framework-docs/src/main/java/org/springframework/docs/integration/cache/cachestoreconfigurationcaffeine/CacheConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.springframework.context.annotation.Configuration;
2323

2424
@Configuration
25-
public class CacheConfiguration {
25+
class CacheConfiguration {
2626

2727
// tag::snippet[]
2828
@Bean

framework-docs/src/main/java/org/springframework/docs/integration/cache/cachestoreconfigurationcaffeine/CustomCacheConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.springframework.context.annotation.Configuration;
2525

2626
@Configuration
27-
public class CustomCacheConfiguration {
27+
class CustomCacheConfiguration {
2828

2929
// tag::snippet[]
3030
@Bean

framework-docs/src/main/java/org/springframework/docs/integration/cache/cachestoreconfigurationjdk/CacheConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import org.springframework.context.annotation.Configuration;
2727

2828
@Configuration
29-
public class CacheConfiguration {
29+
class CacheConfiguration {
3030

3131
// tag::snippet[]
3232
@Bean

framework-docs/src/main/java/org/springframework/docs/integration/cache/cachestoreconfigurationjsr107/CacheConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.springframework.context.annotation.Configuration;
2525

2626
@Configuration
27-
public class CacheConfiguration {
27+
class CacheConfiguration {
2828

2929
// tag::snippet[]
3030
@Bean

framework-docs/src/main/java/org/springframework/docs/integration/cache/cachestoreconfigurationnoop/CacheConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.springframework.context.annotation.Configuration;
2525

2626
@Configuration
27-
public class CacheConfiguration {
27+
class CacheConfiguration {
2828

2929
private CacheManager jdkCache() {
3030
return null;

spring-context/src/main/java/org/springframework/cache/annotation/CachingConfigurer.java

+16-40
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,8 +29,8 @@
2929
* cache management.
3030
*
3131
* <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.
3434
*
3535
* @author Chris Beams
3636
* @author Stephane Nicoll
@@ -46,14 +46,15 @@ public interface CachingConfigurer {
4646
* management of the cache resolution, consider setting the
4747
* {@link CacheResolver} directly.
4848
* <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.
5051
* <pre class="code">
5152
* &#064;Configuration
5253
* &#064;EnableCaching
53-
* public class AppConfig implements CachingConfigurer {
54+
* class AppConfig implements CachingConfigurer {
5455
* &#064;Bean // important!
5556
* &#064;Override
56-
* public CacheManager cacheManager() {
57+
* CacheManager cacheManager() {
5758
* // configure and return CacheManager instance
5859
* }
5960
* // ...
@@ -70,17 +71,18 @@ default CacheManager cacheManager() {
7071
* Return the {@link CacheResolver} bean to use to resolve regular caches for
7172
* annotation-driven cache management. This is an alternative and more powerful
7273
* 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,
7475
* the cache manager is ignored.
7576
* <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.
7779
* <pre class="code">
7880
* &#064;Configuration
7981
* &#064;EnableCaching
80-
* public class AppConfig implements CachingConfigurer {
82+
* class AppConfig implements CachingConfigurer {
8183
* &#064;Bean // important!
8284
* &#064;Override
83-
* public CacheResolver cacheResolver() {
85+
* CacheResolver cacheResolver() {
8486
* // configure and return CacheResolver instance
8587
* }
8688
* // ...
@@ -95,20 +97,8 @@ default CacheResolver cacheResolver() {
9597

9698
/**
9799
* 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-
* &#064;Configuration
102-
* &#064;EnableCaching
103-
* public class AppConfig implements CachingConfigurer {
104-
* &#064;Bean // important!
105-
* &#064;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.
112102
* See @{@link EnableCaching} for more complete examples.
113103
*/
114104
@Nullable
@@ -118,22 +108,8 @@ default KeyGenerator keyGenerator() {
118108

119109
/**
120110
* 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-
* &#064;Configuration
127-
* &#064;EnableCaching
128-
* public class AppConfig implements CachingConfigurer {
129-
* &#064;Bean // important!
130-
* &#064;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.
137113
* See @{@link EnableCaching} for more complete examples.
138114
*/
139115
@Nullable

spring-context/src/main/java/org/springframework/cache/annotation/EnableCaching.java

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -35,16 +35,16 @@
3535
* <pre class="code">
3636
* &#064;Configuration
3737
* &#064;EnableCaching
38-
* public class AppConfig {
38+
* class AppConfig {
3939
*
4040
* &#064;Bean
41-
* public MyService myService() {
41+
* MyService myService() {
4242
* // configure and return a class having &#064;Cacheable methods
4343
* return new MyService();
4444
* }
4545
*
4646
* &#064;Bean
47-
* public CacheManager cacheManager() {
47+
* CacheManager cacheManager() {
4848
* // configure and return an implementation of Spring's CacheManager SPI
4949
* SimpleCacheManager cacheManager = new SimpleCacheManager();
5050
* cacheManager.setCaches(Set.of(new ConcurrentMapCache("default")));
@@ -103,26 +103,25 @@
103103
* <pre class="code">
104104
* &#064;Configuration
105105
* &#064;EnableCaching
106-
* public class AppConfig implements CachingConfigurer {
106+
* class AppConfig implements CachingConfigurer {
107107
*
108108
* &#064;Bean
109-
* public MyService myService() {
109+
* MyService myService() {
110110
* // configure and return a class having &#064;Cacheable methods
111111
* return new MyService();
112112
* }
113113
*
114114
* &#064;Bean
115115
* &#064;Override
116-
* public CacheManager cacheManager() {
116+
* CacheManager cacheManager() {
117117
* // configure and return an implementation of Spring's CacheManager SPI
118118
* SimpleCacheManager cacheManager = new SimpleCacheManager();
119119
* cacheManager.setCaches(Set.of(new ConcurrentMapCache("default")));
120120
* return cacheManager;
121121
* }
122122
*
123-
* &#064;Bean
124123
* &#064;Override
125-
* public KeyGenerator keyGenerator() {
124+
* KeyGenerator keyGenerator() {
126125
* // configure and return an implementation of Spring's KeyGenerator SPI
127126
* return new MyKeyGenerator();
128127
* }
@@ -137,9 +136,8 @@
137136
* org.springframework.cache.interceptor.KeyGenerator KeyGenerator} SPI. Normally,
138137
* {@code @EnableCaching} will configure Spring's
139138
* {@link org.springframework.cache.interceptor.SimpleKeyGenerator SimpleKeyGenerator}
140-
* for this purpose, but when implementing {@code CachingConfigurer}, a key generator
141-
* must be provided explicitly. Return {@code null} or {@code new SimpleKeyGenerator()}
142-
* from this method if no customization is necessary.
139+
* for this purpose, but when implementing {@code CachingConfigurer}, a custom key
140+
* generator can be specified.
143141
*
144142
* <p>{@link CachingConfigurer} offers additional customization options:
145143
* see the {@link CachingConfigurer} javadoc for further details.

0 commit comments

Comments
 (0)