diff --git a/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java b/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java index bb7f1967af..9c53d5b80c 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationClassFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -19,7 +19,7 @@ package org.springframework.aop.support.annotation; import java.lang.annotation.Annotation; import org.springframework.aop.ClassFilter; -import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.util.Assert; /** @@ -50,7 +50,7 @@ public class AnnotationClassFilter implements ClassFilter { * @param annotationType the annotation type to look for * @param checkInherited whether to also check the superclasses and * interfaces as well as meta-annotations for the annotation type - * (i.e. whether to use {@link AnnotationUtils#findAnnotation(Class, Class)} + * (i.e. whether to use {@link AnnotatedElementUtils#hasAnnotation} * semantics instead of standard Java {@link Class#isAnnotationPresent}) */ public AnnotationClassFilter(Class annotationType, boolean checkInherited) { @@ -62,8 +62,7 @@ public class AnnotationClassFilter implements ClassFilter { @Override public boolean matches(Class clazz) { - return (this.checkInherited ? - (AnnotationUtils.findAnnotation(clazz, this.annotationType) != null) : + return (this.checkInherited ? AnnotatedElementUtils.hasAnnotation(clazz, this.annotationType) : clazz.isAnnotationPresent(this.annotationType)); } diff --git a/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java b/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java index 9f529447a3..263f1391aa 100644 --- a/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java +++ b/spring-aop/src/main/java/org/springframework/aop/support/annotation/AnnotationMethodMatcher.java @@ -22,7 +22,7 @@ import java.lang.reflect.Proxy; import org.springframework.aop.support.AopUtils; import org.springframework.aop.support.StaticMethodMatcher; -import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.core.annotation.AnnotatedElementUtils; import org.springframework.util.Assert; /** @@ -54,7 +54,7 @@ public class AnnotationMethodMatcher extends StaticMethodMatcher { * @param annotationType the annotation type to look for * @param checkInherited whether to also check the superclasses and * interfaces as well as meta-annotations for the annotation type - * (i.e. whether to use {@link AnnotationUtils#findAnnotation(Method, Class)} + * (i.e. whether to use {@link AnnotatedElementUtils#hasAnnotation} * semantics instead of standard Java {@link Method#isAnnotationPresent}) * @since 5.0 */ @@ -81,8 +81,7 @@ public class AnnotationMethodMatcher extends StaticMethodMatcher { } private boolean matchesMethod(Method method) { - return (this.checkInherited ? - (AnnotationUtils.findAnnotation(method, this.annotationType) != null) : + return (this.checkInherited ? AnnotatedElementUtils.hasAnnotation(method, this.annotationType) : method.isAnnotationPresent(this.annotationType)); }