Introduce 'value' alias for 'attribute' in @AliasFor
SPR-11512 introduced support for annotation attribute aliases via
@AliasFor, requiring the explicit declaration of the 'attribute'
attribute. However, for aliases within an annotation, this explicit
declaration is unnecessary.
This commit improves the readability of alias pairs declared within an
annotation by introducing a 'value' attribute in @AliasFor that is an
alias for the existing 'attribute' attribute. This allows annotations
such as @ContextConfiguration from the spring-test module to declare
aliases as follows.
public @interface ContextConfiguration {
@AliasFor("locations")
String[] value() default {};
@AliasFor("value")
String[] locations() default {};
// ...
}
Issue: SPR-13289
This commit is contained in:
@@ -39,14 +39,14 @@ public @interface Header {
|
||||
/**
|
||||
* Alias for {@link #name}.
|
||||
*/
|
||||
@AliasFor(attribute = "name")
|
||||
@AliasFor("name")
|
||||
String value() default "";
|
||||
|
||||
/**
|
||||
* The name of the request header to bind to.
|
||||
* @since 4.2
|
||||
*/
|
||||
@AliasFor(attribute = "value")
|
||||
@AliasFor("value")
|
||||
String name() default "";
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,7 +43,7 @@ public @interface Payload {
|
||||
/**
|
||||
* Alias for {@link #expression}.
|
||||
*/
|
||||
@AliasFor(attribute = "expression")
|
||||
@AliasFor("expression")
|
||||
String value() default "";
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ public @interface Payload {
|
||||
* <p>When processing STOMP over WebSocket messages this attribute is not supported.
|
||||
* @since 4.2
|
||||
*/
|
||||
@AliasFor(attribute = "value")
|
||||
@AliasFor("value")
|
||||
String expression() default "";
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,7 @@ public @interface SendToUser {
|
||||
* Alias for {@link #destinations}.
|
||||
* @see #destinations
|
||||
*/
|
||||
@AliasFor(attribute = "destinations")
|
||||
@AliasFor("destinations")
|
||||
String[] value() default {};
|
||||
|
||||
/**
|
||||
@@ -57,7 +57,7 @@ public @interface SendToUser {
|
||||
* @see #value
|
||||
* @see org.springframework.messaging.simp.annotation.support.SendToMethodReturnValueHandler
|
||||
*/
|
||||
@AliasFor(attribute = "value")
|
||||
@AliasFor("value")
|
||||
String[] destinations() default {};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user