org.springframework.aop.framework
Class DefaultAopProxyFactory

java.lang.Object
  extended by org.springframework.aop.framework.DefaultAopProxyFactory
All Implemented Interfaces:
java.io.Serializable, AopProxyFactory

public class DefaultAopProxyFactory
extends java.lang.Object
implements AopProxyFactory, java.io.Serializable

Default AopProxyFactory implementation, creating either a CGLIB proxy or a JDK dynamic proxy.

Creates a CGLIB proxy if one the following is true for a given AdvisedSupport instance:

Note that the CGLIB library classes have to be present on the class path if an actual CGLIB proxy needs to be created.

In general, specify "proxyTargetClass" to enforce a CGLIB proxy, or specify one or more interfaces to use a JDK dynamic proxy.

Since:
12.03.2004
Author:
Rod Johnson, Juergen Hoeller
See Also:
ProxyConfig.setOptimize(boolean), ProxyConfig.setProxyTargetClass(boolean), AdvisedSupport.setInterfaces(java.lang.Class[]), Serialized Form

Nested Class Summary
private static class DefaultAopProxyFactory.CglibProxyFactory
          Inner factory class used to just introduce a CGLIB2 dependency when actually creating a CGLIB proxy.
 
Field Summary
private static boolean cglibAvailable
          Whether the CGLIB2 library is present on the classpath
 
Constructor Summary
DefaultAopProxyFactory()
           
 
Method Summary
 AopProxy createAopProxy(AdvisedSupport config)
          Create an AopProxy for the given AOP configuration.
private  boolean hasNoUserSuppliedProxyInterfaces(AdvisedSupport config)
          Determine whether the supplied AdvisedSupport has only the SpringProxy interface specified (or no proxy interfaces specified at all).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cglibAvailable

private static final boolean cglibAvailable
Whether the CGLIB2 library is present on the classpath

Constructor Detail

DefaultAopProxyFactory

public DefaultAopProxyFactory()
Method Detail

createAopProxy

public AopProxy createAopProxy(AdvisedSupport config)
                        throws AopConfigException
Description copied from interface: AopProxyFactory
Create an AopProxy for the given AOP configuration.

Specified by:
createAopProxy in interface AopProxyFactory
Parameters:
config - the AOP configuration in the form of an AdvisedSupport object
Returns:
the corresponding AOP proxy
Throws:
AopConfigException - if the configuration is invalid

hasNoUserSuppliedProxyInterfaces

private boolean hasNoUserSuppliedProxyInterfaces(AdvisedSupport config)
Determine whether the supplied AdvisedSupport has only the SpringProxy interface specified (or no proxy interfaces specified at all).