From d7b45b7c8ee7bf9fc780d5512005a273846d9ee1 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sat, 9 Jul 2022 17:15:13 +0200 Subject: [PATCH] Improve diagnostics for convention-based annotation attribute overrides The warning message logged for an annotation that still uses convention-based overrides now includes a concrete suggestion for how the problem may potentially be fixed. WARN - Support for convention-based annotation attribute overrides is deprecated and will be removed in Spring Framework 6.1. Please annotate the 'locations' attribute in @org.springframework.core.annotation.MergedAnnotationsTests$ConventionBasedComposedContextConfiguration with an appropriate @AliasFor declaration -- for example, @AliasFor(annotation = org.springframework.core.annotation.MergedAnnotationsTests$ContextConfiguration.class). See gh-28760 --- .../core/annotation/AnnotationTypeMapping.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationTypeMapping.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationTypeMapping.java index 6b25fa57fab..05a9cc7ea3b 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationTypeMapping.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationTypeMapping.java @@ -296,8 +296,8 @@ final class AnnotationTypeMapping { Support for convention-based annotation attribute overrides is \ deprecated and will be removed in Spring Framework 6.1. Please \ annotate the '%s' attribute in @%s with an appropriate @AliasFor \ - declaration.""" - .formatted(name, rootAnnotationTypeName)); + declaration -- for example, @AliasFor(annotation = %s.class).""" + .formatted(name, rootAnnotationTypeName, this.annotationType.getName())); } mappings[i] = mapped; MirrorSet mirrors = getMirrorSets().getAssigned(i);