From 967a2ef2d20b7bc6f6bf79463ee15d7c3e2ec607 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 12 Mar 2018 20:41:44 +0100 Subject: [PATCH] Validate Class attributes as well as Class array attributes Issue: SPR-16564 --- .../org/springframework/core/annotation/AnnotationUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java index 3fb11e3095..59c6cf5327 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java @@ -912,7 +912,8 @@ public abstract class AnnotationUtils { */ public static void validateAnnotation(Annotation annotation) { for (Method method : getAttributeMethods(annotation.annotationType())) { - if (method.getReturnType() == Class.class) { + Class returnType = method.getReturnType(); + if (returnType == Class.class || returnType == Class[].class) { try { method.invoke(annotation); }