diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java index 25019c010f..88cefdbab6 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java @@ -37,7 +37,6 @@ import org.apache.commons.logging.LogFactory; import org.springframework.core.BridgeMethodResolver; import org.springframework.util.Assert; -import org.springframework.util.ClassUtils; import org.springframework.util.ConcurrentReferenceHashMap; import org.springframework.util.ObjectUtils; import org.springframework.util.ReflectionUtils; @@ -1277,7 +1276,7 @@ public abstract class AnnotationUtils { DefaultAnnotationAttributeExtractor attributeExtractor = new DefaultAnnotationAttributeExtractor(annotation, annotatedElement); InvocationHandler handler = new SynthesizedAnnotationInvocationHandler(attributeExtractor); - return (A) Proxy.newProxyInstance(ClassUtils.getDefaultClassLoader(), + return (A) Proxy.newProxyInstance(annotation.getClass().getClassLoader(), new Class[] {(Class) annotationType, SynthesizedAnnotation.class}, handler); } @@ -1323,7 +1322,7 @@ public abstract class AnnotationUtils { MapAnnotationAttributeExtractor attributeExtractor = new MapAnnotationAttributeExtractor(attributes, annotationType, annotatedElement); InvocationHandler handler = new SynthesizedAnnotationInvocationHandler(attributeExtractor); - return (A) Proxy.newProxyInstance(ClassUtils.getDefaultClassLoader(), + return (A) Proxy.newProxyInstance(annotationType.getClassLoader(), new Class[] {annotationType, SynthesizedAnnotation.class}, handler); }