|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.aop.framework.ProxyConfig
public class ProxyConfig
Convenience superclass for configuration used in creating proxies, to ensure that all proxy creators have consistent properties.
Note that it is no longer possible to configure subclasses to expose the MethodInvocation. Interceptors should normally manage their own ThreadLocals if they need to make resources available to advised objects. If it's absolutely necessary to expose the MethodInvocation, use an interceptor to do so.
Field Summary | |
---|---|
protected boolean |
exposeProxy
Should proxies obtained from this configuration expose the AOP proxy for the AopContext class to retrieve for targets? |
protected org.apache.commons.logging.Log |
logger
Transient to optimize serialization: AdvisedSupport resets it. |
Constructor Summary | |
---|---|
ProxyConfig()
|
Method Summary | |
---|---|
void |
copyFrom(ProxyConfig other)
Copy configuration from the other config object. |
AopProxyFactory |
getAopProxyFactory()
Return the AopProxyFactory that this ProxyConfig uses. |
boolean |
isExposeProxy()
Return whether the AOP proxy will expose the AOP proxy for each invocation. |
boolean |
isFrozen()
Return whether the config is frozen, and no advice changes can be made. |
boolean |
isOpaque()
Return whether proxies created by this configuration should be prevented from being cast to Advised. |
boolean |
isOptimize()
Return whether proxies should perform aggressive optimizations. |
boolean |
isProxyTargetClass()
Return whether to proxy the target class directly as well as any interfaces. |
void |
setAopProxyFactory(AopProxyFactory apf)
Customize the AopProxyFactory, allowing different strategies to be dropped in without changing the core framework. |
void |
setExposeProxy(boolean exposeProxy)
Set whether the proxy should be exposed by the AOP framework as a ThreadLocal for retrieval via the AopContext class. |
void |
setFrozen(boolean frozen)
Set whether this config should be frozen. |
void |
setOpaque(boolean opaque)
Set whether proxies created by this configuration should be prevented from being cast to Advised to query proxy status. |
void |
setOptimize(boolean optimize)
Set whether proxies should perform aggressive optimizations. |
void |
setProxyTargetClass(boolean proxyTargetClass)
Set whether to proxy the target class directly as well as any interfaces. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected transient org.apache.commons.logging.Log logger
protected boolean exposeProxy
Constructor Detail |
---|
public ProxyConfig()
Method Detail |
---|
public void setProxyTargetClass(boolean proxyTargetClass)
public boolean isProxyTargetClass()
public void setOptimize(boolean optimize)
For example, optimization will usually mean that advice changes won't take effect after a proxy has been created. For this reason, optimization is disabled by default. An optimize value of "true" may be ignored if other settings preclude optimization: for example, if "exposeProxy" is set to "true" and that's not compatible with the optimization.
For example, CGLIB-enhanced proxies may optimize out. overriding methods with no advice chain. This can produce 2.5x performance improvement for methods with no advice.
Warning: Setting this to "true" can produce large performance gains when using CGLIB (also set "proxyTargetClass" to "true"), so it's a good setting for performance-critical proxies. However, enabling this will mean that advice cannot be changed after a proxy has been obtained from this factory.
public boolean isOptimize()
public void setExposeProxy(boolean exposeProxy)
this
, the invocation will not be advised).
Default is "false", for optimal performance.
public boolean isExposeProxy()
public void setFrozen(boolean frozen)
When a config is frozen, no advice changes can be made. This is useful for optimization, and useful when we don't want callers to be able to manipulate configuration after casting to Advised.
public boolean isFrozen()
public void setAopProxyFactory(AopProxyFactory apf)
For example, an AopProxyFactory could return an AopProxy using dynamic proxies, CGLIB or code generation strategy.
public AopProxyFactory getAopProxyFactory()
public void setOpaque(boolean opaque)
public boolean isOpaque()
public void copyFrom(ProxyConfig other)
other
- object to copy configuration frompublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |