diff --git a/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java b/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java index e226accd5c6..0891a419c3e 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -184,6 +184,9 @@ final class SynthesizedMergedAnnotationInvocationHandler i } private static boolean isVisible(ClassLoader classLoader, Class interfaceClass) { + if (classLoader == interfaceClass.getClassLoader()) { + return true; + } try { return Class.forName(interfaceClass.getName(), false, classLoader) == interfaceClass; }