EnableAspectJAutoProxy features exposeProxy flag (analogous to XML namespace)
Issue: SPR-10454
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -27,6 +27,7 @@ import org.springframework.core.type.AnnotationMetadata;
|
||||
* as appropriate based on a given @{@link EnableAspectJAutoProxy} annotation.
|
||||
*
|
||||
* @author Chris Beams
|
||||
* @author Juergen Hoeller
|
||||
* @since 3.1
|
||||
* @see EnableAspectJAutoProxy
|
||||
*/
|
||||
@@ -43,11 +44,14 @@ class AspectJAutoProxyRegistrar implements ImportBeanDefinitionRegistrar {
|
||||
|
||||
AopConfigUtils.registerAspectJAnnotationAutoProxyCreatorIfNecessary(registry);
|
||||
|
||||
AnnotationAttributes enableAJAutoProxy =
|
||||
AnnotationAttributes enableAspectJAutoProxy =
|
||||
AnnotationConfigUtils.attributesFor(importingClassMetadata, EnableAspectJAutoProxy.class);
|
||||
if (enableAJAutoProxy.getBoolean("proxyTargetClass")) {
|
||||
if (enableAspectJAutoProxy.getBoolean("proxyTargetClass")) {
|
||||
AopConfigUtils.forceAutoProxyCreatorToUseClassProxying(registry);
|
||||
}
|
||||
if (enableAspectJAutoProxy.getBoolean("exposeProxy")) {
|
||||
AopConfigUtils.forceAutoProxyCreatorToExposeProxy(registry);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ import java.lang.annotation.Target;
|
||||
* }</pre>
|
||||
*
|
||||
* @author Chris Beams
|
||||
* @author Juergen Hoeller
|
||||
* @since 3.1
|
||||
* @see org.aspectj.lang.annotation.Aspect
|
||||
*/
|
||||
@@ -117,4 +118,12 @@ public @interface EnableAspectJAutoProxy {
|
||||
*/
|
||||
boolean proxyTargetClass() default false;
|
||||
|
||||
/**
|
||||
* Indicate that the proxy should be exposed by the AOP framework as a {@code ThreadLocal}
|
||||
* for retrieval via the {@link org.springframework.aop.framework.AopContext} class.
|
||||
* Off by default, i.e. no guarantees that {@code AopContext} access will work.
|
||||
* @since 4.3.1
|
||||
*/
|
||||
boolean exposeProxy() default false;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user