diff --git a/Spring-Annotation-Programming-Model.md b/Spring-Annotation-Programming-Model.md index 3a8d3bd..4d9f65e 100644 --- a/Spring-Annotation-Programming-Model.md +++ b/Spring-Annotation-Programming-Model.md @@ -148,8 +148,8 @@ declare a pair of aliased attributes _within_ a single annotation or to declare an alias from one attribute in a custom composed annotation to an attribute in a meta-annotation. -For example, `@ContextConfiguration` from the `spring-test` module is now -declared as follows: +For example, `@ContextConfiguration` from the `spring-test` module is +declared as follows. ```java public @interface ContextConfiguration { @@ -164,6 +164,25 @@ public @interface ContextConfiguration { } ``` +The `locations` attribute is declared as an alias for the `value` +attribute, and vice versa. Consequently, the following declarations +of `@ContextConfiguration` are equivalent. + +```java +@ContextConfiguration("/test-config.xml") +public class MyTests { /* ... */ } +``` + +```java +@ContextConfiguration(value = "/test-config.xml") +public class MyTests { /* ... */ } +``` + +```java +@ContextConfiguration(locations = "/test-config.xml") +public class MyTests { /* ... */ } +``` + Similarly, _composed annotations_ that override attributes from meta-annotations can use `@AliasFor` for fine-grained control over exactly which attributes are overridden within an annotation hierarchy. In fact, it is