diff --git a/core/src/main/java/org/springframework/security/access/annotation/SecuredAnnotationSecurityMetadataSource.java b/core/src/main/java/org/springframework/security/access/annotation/SecuredAnnotationSecurityMetadataSource.java index 162eeb52d3..bb1dd46b96 100644 --- a/core/src/main/java/org/springframework/security/access/annotation/SecuredAnnotationSecurityMetadataSource.java +++ b/core/src/main/java/org/springframework/security/access/annotation/SecuredAnnotationSecurityMetadataSource.java @@ -35,7 +35,7 @@ import org.springframework.security.access.method.AbstractFallbackMethodSecurity public class SecuredAnnotationSecurityMetadataSource extends AbstractFallbackMethodSecurityMetadataSource { protected Collection findAttributes(Class clazz) { - return processAnnotation(clazz.getAnnotation(Secured.class)); + return processAnnotation(AnnotationUtils.findAnnotation(clazz, Secured.class)); } protected Collection findAttributes(Method method, Class targetClass) { diff --git a/core/src/main/java/org/springframework/security/access/prepost/PrePostAnnotationSecurityMetadataSource.java b/core/src/main/java/org/springframework/security/access/prepost/PrePostAnnotationSecurityMetadataSource.java index 5138f5f25d..79fd1541ab 100644 --- a/core/src/main/java/org/springframework/security/access/prepost/PrePostAnnotationSecurityMetadataSource.java +++ b/core/src/main/java/org/springframework/security/access/prepost/PrePostAnnotationSecurityMetadataSource.java @@ -105,23 +105,13 @@ public class PrePostAnnotationSecurityMetadataSource extends AbstractMethodSecur } // Check the class-level (note declaringClass, not targetClass, which may not actually implement the method) - annotation = specificMethod.getDeclaringClass().getAnnotation(annotationClass); + annotation = AnnotationUtils.findAnnotation(specificMethod.getDeclaringClass(), annotationClass); if (annotation != null) { logger.debug(annotation + " found on: " + specificMethod.getDeclaringClass().getName()); return annotation; } - // Check for a possible interface annotation which would not be inherited by the declaring class - if (specificMethod != method) { - annotation = method.getDeclaringClass().getAnnotation(annotationClass); - - if (annotation != null) { - logger.debug(annotation + " found on: " + method.getDeclaringClass().getName()); - return annotation; - } - } - return null; }