Browse Source

AnnotationUtils.getAnnotationAttributes makes Method accessible (analogous to AnnotationUtils.getValue)

Issue: SPR-12858
(cherry picked from commit 1d33fd0)
pull/769/head
Juergen Hoeller 11 years ago
parent
commit
89f5248189
  1. 5
      spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java

5
spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -319,8 +319,8 @@ public abstract class AnnotationUtils { @@ -319,8 +319,8 @@ public abstract class AnnotationUtils {
* <p>The algorithm operates as follows:
* <ol>
* <li>Search for the annotation on the given class and return it if found.
* <li>Recursively search through all interfaces that the given class declares.
* <li>Recursively search through all annotations that the given class declares.
* <li>Recursively search through all interfaces that the given class declares.
* <li>Recursively search through the superclass hierarchy of the given class.
* </ol>
* <p>Note: in this context, the term <em>recursively</em> means that the search
@ -583,6 +583,7 @@ public abstract class AnnotationUtils { @@ -583,6 +583,7 @@ public abstract class AnnotationUtils {
for (Method method : methods) {
if (method.getParameterTypes().length == 0 && method.getReturnType() != void.class) {
try {
ReflectionUtils.makeAccessible(method);
Object value = method.invoke(annotation);
attrs.put(method.getName(), adaptValue(value, classValuesAsString, nestedAnnotationsAsMap));
}

Loading…
Cancel
Save