提交 4dc31667 编写于 作者: J Juergen Hoeller

AnnotationUtils defines synthesized proxy class in original annotation's ClassLoader

Issue: SPR-13634
上级 77af692e
......@@ -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<A>) 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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册