Add default methods to CachingConfigurer
This commit adds default methods to CachingConfigurer and JCacheConfigurer and removes the reference to their respective support classes as they are now irrelevant. Closes gh-27811
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,8 +26,7 @@ import org.springframework.lang.Nullable;
|
||||
* Interface to be implemented by @{@link org.springframework.context.annotation.Configuration
|
||||
* Configuration} classes annotated with @{@link EnableCaching} that wish or need to
|
||||
* specify explicitly how caches are resolved and how keys are generated for annotation-driven
|
||||
* cache management. Consider extending {@link CachingConfigurerSupport}, which provides a
|
||||
* stub implementation of all interface methods.
|
||||
* cache management.
|
||||
*
|
||||
* <p>See @{@link EnableCaching} for general examples and context; see
|
||||
* {@link #cacheManager()}, {@link #cacheResolver()} and {@link #keyGenerator()}
|
||||
@@ -37,7 +36,6 @@ import org.springframework.lang.Nullable;
|
||||
* @author Stephane Nicoll
|
||||
* @since 3.1
|
||||
* @see EnableCaching
|
||||
* @see CachingConfigurerSupport
|
||||
*/
|
||||
public interface CachingConfigurer {
|
||||
|
||||
@@ -64,7 +62,9 @@ public interface CachingConfigurer {
|
||||
* See @{@link EnableCaching} for more complete examples.
|
||||
*/
|
||||
@Nullable
|
||||
CacheManager cacheManager();
|
||||
default CacheManager cacheManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link CacheResolver} bean to use to resolve regular caches for
|
||||
@@ -89,7 +89,9 @@ public interface CachingConfigurer {
|
||||
* See {@link EnableCaching} for more complete examples.
|
||||
*/
|
||||
@Nullable
|
||||
CacheResolver cacheResolver();
|
||||
default CacheResolver cacheResolver() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the key generator bean to use for annotation-driven cache management.
|
||||
@@ -110,7 +112,9 @@ public interface CachingConfigurer {
|
||||
* See @{@link EnableCaching} for more complete examples.
|
||||
*/
|
||||
@Nullable
|
||||
KeyGenerator keyGenerator();
|
||||
default KeyGenerator keyGenerator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link CacheErrorHandler} to use to handle cache-related errors.
|
||||
@@ -133,6 +137,8 @@ public interface CachingConfigurer {
|
||||
* See @{@link EnableCaching} for more complete examples.
|
||||
*/
|
||||
@Nullable
|
||||
CacheErrorHandler errorHandler();
|
||||
default CacheErrorHandler errorHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user