mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Introduce value alias for cacheNames in @CacheConfig
Prior to this commit @CacheConfig did not have a `value` attribute alias for `cacheNames`, even though the rest of the cache-related annotations (such as @Cacheable, @CachePut, etc.) do have a `value` / `cacheNames` alias pair. To address that inconsistency, this commit introduces a `value` alias for `cacheNames` in @CacheConfig as well. See gh-35096 Closes gh-35152
This commit is contained in:
+11
@@ -22,6 +22,8 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
|
||||
/**
|
||||
* {@code @CacheConfig} provides a mechanism for sharing common cache-related
|
||||
* settings at the class level.
|
||||
@@ -39,6 +41,13 @@ import java.lang.annotation.Target;
|
||||
@Documented
|
||||
public @interface CacheConfig {
|
||||
|
||||
/**
|
||||
* Alias for {@link #cacheNames}.
|
||||
* @since 7.0
|
||||
*/
|
||||
@AliasFor("cacheNames")
|
||||
String[] value() default {};
|
||||
|
||||
/**
|
||||
* Names of the default caches to consider for caching operations defined
|
||||
* in the annotated class.
|
||||
@@ -47,7 +56,9 @@ public @interface CacheConfig {
|
||||
* configured {@link #cacheResolver()} which typically delegates to
|
||||
* {@link org.springframework.cache.CacheManager#getCache}.
|
||||
* For further details see {@link Cacheable#cacheNames()}.
|
||||
* @see #value
|
||||
*/
|
||||
@AliasFor("value")
|
||||
String[] cacheNames() default {};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user