Source:
private void prepareEvaluationContext() { StandardEvaluationContext context = getEvaluationContext(false); Class<?> targetType = AopUtils.getTargetClass(this.targetObject); ReflectiveMethodResolver declaredMethodResolver = new ReflectiveMethodResolver() { @Override protected Method[] getMethods(Class<?> type) { return type.getDeclaredMethods(); } }; if (this.method != null) { FixedMethodFilter fixedMethodFilter = new FixedMethodFilter(this.method); context.registerMethodFilter(targetType, fixedMethodFilter); declaredMethodResolver.registerMethodFilter(targetType, fixedMethodFilter); if (this.expectedType != null) { Assert.state(context.getTypeConverter() .canConvert(TypeDescriptor.valueOf((this.method).getReturnType()), TypeDescriptor.valueOf(this.expectedType)), "Cannot convert to expected type (" + this.expectedType + ") from " + this.method); } } else { AnnotatedMethodFilter annotatedMethodFilter = new AnnotatedMethodFilter(this.annotationType, this.methodName, this.requiresReply); Assert.state(canReturnExpectedType(annotatedMethodFilter, targetType, context.getTypeConverter()), "Cannot convert to expected type (" + this.expectedType + ") from " + this.method); context.registerMethodFilter(targetType, annotatedMethodFilter); declaredMethodResolver.registerMethodFilter(targetType, annotatedMethodFilter); } context.setVariable("target", this.targetObject); context.addMethodResolver(declaredMethodResolver); }

Target:
private void prepareEvaluationContext() { StandardEvaluationContext context = getEvaluationContext(false); Class<?> targetType = AopUtils.getTargetClass(this.targetObject); ReflectiveMethodResolver declaredMethodResolver = new ReflectiveMethodResolver() { @Override protected Method[] getMethods(Class<?> type) { return Stream.of(type.getMethods(), type.getDeclaredMethods()) .flatMap(Stream::of) .distinct() .toArray(Method[]::new); } }; if (this.method != null) { FixedMethodFilter fixedMethodFilter = new FixedMethodFilter(this.method); context.registerMethodFilter(targetType, fixedMethodFilter); declaredMethodResolver.registerMethodFilter(targetType, fixedMethodFilter); if (this.expectedType != null) { Assert.state(context.getTypeConverter() .canConvert(TypeDescriptor.valueOf((this.method).getReturnType()), TypeDescriptor.valueOf(this.expectedType)), "Cannot convert to expected type (" + this.expectedType + ") from " + this.method); } } else { AnnotatedMethodFilter annotatedMethodFilter = new AnnotatedMethodFilter(this.annotationType, this.methodName, this.requiresReply); Assert.state(canReturnExpectedType(annotatedMethodFilter, targetType, context.getTypeConverter()), "Cannot convert to expected type (" + this.expectedType + ") from " + this.method); context.registerMethodFilter(targetType, annotatedMethodFilter); declaredMethodResolver.registerMethodFilter(targetType, annotatedMethodFilter); } context.setVariable("target", this.targetObject); context.addMethodResolver(declaredMethodResolver); for (Iterator<MethodResolver> iterator = context.getMethodResolvers().iterator(); iterator.hasNext();) { MethodResolver methodResolver = iterator.next(); if (methodResolver.getClass().equals(ReflectiveMethodResolver.class)) { iterator.remove(); } } }