@@ -53,9 +53,8 @@ final class AnnotationTypeMapping {
53
53
private static final Log logger = LogFactory .getLog (AnnotationTypeMapping .class );
54
54
55
55
/**
56
- * Set of fully qualified class names concatenated with attribute names for
57
- * annotations which we have already checked for use of convention-based
58
- * annotation attribute overrides.
56
+ * Set of fully qualified class names for annotations which we have already
57
+ * checked for use of convention-based annotation attribute overrides.
59
58
* @since 6.0
60
59
* @see #addConventionMappings()
61
60
*/
@@ -284,21 +283,12 @@ private void addConventionMappings() {
284
283
}
285
284
AttributeMethods rootAttributes = this .root .getAttributes ();
286
285
int [] mappings = this .conventionMappings ;
286
+ Set <String > conventionMappedAttributes = new HashSet <>();
287
287
for (int i = 0 ; i < mappings .length ; i ++) {
288
288
String name = this .attributes .get (i ).getName ();
289
289
int mapped = rootAttributes .indexOf (name );
290
290
if (!MergedAnnotation .VALUE .equals (name ) && mapped != -1 && !isExplicitAttributeOverride (name )) {
291
- String rootAnnotationTypeName = this .root .annotationType .getName ();
292
- String cacheKey = rootAnnotationTypeName + "." + name ;
293
- // We want to avoid duplicate log warnings as much as possible, without full synchronization.
294
- if (conventionBasedOverrideCheckCache .add (cacheKey ) && logger .isWarnEnabled ()) {
295
- logger .warn ("""
296
- Support for convention-based annotation attribute overrides is \
297
- deprecated and will be removed in Spring Framework 6.1. Please \
298
- annotate the '%s' attribute in @%s with an appropriate @AliasFor \
299
- declaration -- for example, @AliasFor(annotation = %s.class)."""
300
- .formatted (name , rootAnnotationTypeName , this .annotationType .getName ()));
301
- }
291
+ conventionMappedAttributes .add (name );
302
292
mappings [i ] = mapped ;
303
293
MirrorSet mirrors = getMirrorSets ().getAssigned (i );
304
294
if (mirrors != null ) {
@@ -308,6 +298,16 @@ private void addConventionMappings() {
308
298
}
309
299
}
310
300
}
301
+ String rootAnnotationTypeName = this .root .annotationType .getName ();
302
+ // We want to avoid duplicate log warnings as much as possible, without full synchronization.
303
+ if (conventionBasedOverrideCheckCache .add (rootAnnotationTypeName ) &&
304
+ !conventionMappedAttributes .isEmpty () && logger .isWarnEnabled ()) {
305
+ logger .warn ("""
306
+ Support for convention-based annotation attribute overrides is deprecated \
307
+ and will be removed in Spring Framework 6.1. Please annotate the following \
308
+ attributes in @%s with appropriate @AliasFor declarations: %s"""
309
+ .formatted (rootAnnotationTypeName , conventionMappedAttributes ));
310
+ }
311
311
}
312
312
313
313
/**
0 commit comments