Stop using convention-based annotation attribute overrides in tests

This commit replaces convention-based annotation attribute overrides in
tests with explicit use of @AliasFor -- except for tests in spring-core,
since we still want to test our support for convention-based annotation
attribute overrides.

See gh-28760
This commit is contained in:
Sam Brannen
2022-07-08 18:59:06 +02:00
parent 6812de7b82
commit 73d92d66b9
11 changed files with 51 additions and 4 deletions

View File

@@ -1061,6 +1061,8 @@ class AnnotatedElementUtilsTests {
@Retention(RetentionPolicy.RUNTIME)
@interface ConventionBasedComposedContextConfig {
// Do NOT use @AliasFor here until Spring 6.1
// @AliasFor(annotation = ContextConfig.class)
String[] locations() default {};
}
@@ -1068,6 +1070,8 @@ class AnnotatedElementUtilsTests {
@Retention(RetentionPolicy.RUNTIME)
@interface InvalidConventionBasedComposedContextConfig {
// Do NOT use @AliasFor here until Spring 6.1
// @AliasFor(annotation = ContextConfig.class)
String[] locations();
}
@@ -1225,9 +1229,13 @@ class AnnotatedElementUtilsTests {
@AliasFor(annotation = ContextConfig.class, attribute = "locations")
String[] locations() default {};
// Do NOT use @AliasFor(annotation = ...) here until Spring 6.1
// @AliasFor(annotation = ContextConfig.class, attribute = "classes")
@AliasFor("value")
Class<?>[] classes() default {};
// Do NOT use @AliasFor(annotation = ...) here until Spring 6.1
// @AliasFor(annotation = ContextConfig.class, attribute = "classes")
@AliasFor("classes")
Class<?>[] value() default {};
}
@@ -1266,6 +1274,8 @@ class AnnotatedElementUtilsTests {
@Retention(RetentionPolicy.RUNTIME)
@interface ConventionBasedSinglePackageComponentScan {
// Do NOT use @AliasFor here until Spring 6.1
// @AliasFor(annotation = ComponentScan.class)
String basePackages();
}

View File

@@ -1367,6 +1367,8 @@ class AnnotationUtilsTests {
@WebMapping(method = RequestMethod.POST, name = "")
@interface Post {
// Do NOT use @AliasFor here until Spring 6.1
// @AliasFor(annotation = WebMapping.class)
String path() default "";
}

View File

@@ -2425,6 +2425,8 @@ class MergedAnnotationsTests {
@Retention(RetentionPolicy.RUNTIME)
@interface ConventionBasedComposedContextConfiguration {
// Do NOT use @AliasFor here until Spring 6.1
// @AliasFor(annotation = ContextConfiguration.class)
String[] locations() default {};
}
@@ -2432,6 +2434,8 @@ class MergedAnnotationsTests {
@Retention(RetentionPolicy.RUNTIME)
@interface InvalidConventionBasedComposedContextConfiguration {
// Do NOT use @AliasFor here until Spring 6.1
// @AliasFor(annotation = ContextConfiguration.class)
String[] locations();
}
@@ -2443,6 +2447,8 @@ class MergedAnnotationsTests {
@Retention(RetentionPolicy.RUNTIME)
@interface HalfConventionBasedAndHalfAliasedComposedContextConfiguration {
// Do NOT use @AliasFor here until Spring 6.1
// @AliasFor(annotation = ContextConfiguration.class)
String[] locations() default {};
@AliasFor(annotation = ContextConfiguration.class, attribute = "locations")
@@ -2564,9 +2570,13 @@ class MergedAnnotationsTests {
@AliasFor(annotation = ContextConfiguration.class, attribute = "locations")
String[] locations() default {};
// Do NOT use @AliasFor(annotation = ...) here until Spring 6.1
// @AliasFor(annotation = ContextConfiguration.class, attribute = "classes")
@AliasFor("value")
Class<?>[] classes() default {};
// Do NOT use @AliasFor(annotation = ...) here until Spring 6.1
// @AliasFor(annotation = ContextConfiguration.class, attribute = "classes")
@AliasFor("classes")
Class<?>[] value() default {};
}
@@ -2603,6 +2613,8 @@ class MergedAnnotationsTests {
@Retention(RetentionPolicy.RUNTIME)
@interface ConventionBasedSinglePackageComponentScan {
// Do NOT use @AliasFor here until Spring 6.1
// @AliasFor(annotation = ComponentScan.class)
String basePackages();
}
@@ -3193,6 +3205,8 @@ class MergedAnnotationsTests {
@RequestMapping(method = RequestMethod.POST, name = "")
@interface PostMapping {
// Do NOT use @AliasFor here until Spring 6.1
// @AliasFor(annotation = RequestMapping.class)
String path() default "";
}

View File

@@ -196,6 +196,8 @@ class TypeMappedAnnotationTests {
String value() default "";
// Do NOT use @AliasFor here until Spring 6.1
// @AliasFor(annotation = ConventionAliasMetaAnnotationTarget.class)
String convention() default "";
}

View File

@@ -549,6 +549,8 @@ class AnnotationMetadataTests {
@Target(ElementType.TYPE)
public @interface ComposedConfigurationWithAttributeOverrides {
// Do NOT use @AliasFor here until Spring 6.1
// @AliasFor(annotation = TestComponentScan.class)
String[] basePackages() default {};
}