List of usage examples for org.springframework.aop.framework AdvisedSupport EMPTY_TARGET_SOURCE
TargetSource EMPTY_TARGET_SOURCE
To view the source code for org.springframework.aop.framework AdvisedSupport EMPTY_TARGET_SOURCE.
Click Source Link
From source file:org.springframework.aop.framework.Cglib2AopProxy.java
/** * Create a new Cglib2AopProxy for the given AOP configuration. * @throws AopConfigException if the config is invalid. We try to throw an informative * exception in this case, rather than let a mysterious failure happen later. *///from w ww. jav a 2 s .c o m protected Cglib2AopProxy(AdvisedSupport config) throws AopConfigException { if (config == null) { throw new AopConfigException("Cannot create AopProxy with null ProxyConfig"); } if (config.getAdvisors().length == 0 && config.getTargetSource() == AdvisedSupport.EMPTY_TARGET_SOURCE) { throw new AopConfigException("Cannot create AopProxy with no advisors and no target source"); } //DK - is this check really necessary? //should this 'config.getTargetSource() == AdvisedSupport.EMPTY_TARGET_SOURCE' be enough? if (config.getTargetSource().getTargetClass() == null) { throw new AopConfigException("Either an interface or a target is required for proxy creation"); } this.advised = config; }
From source file:org.springframework.aop.framework.CglibAopProxy.java
/** * Create a new CglibAopProxy for the given AOP configuration. * @param config the AOP configuration as AdvisedSupport object * @throws AopConfigException if the config is invalid. We try to throw an informative * exception in this case, rather than let a mysterious failure happen later. *///www . j a v a2 s .c o m public CglibAopProxy(AdvisedSupport config) throws AopConfigException { Assert.notNull(config, "AdvisedSupport must not be null"); if (config.getAdvisors().length == 0 && config.getTargetSource() == AdvisedSupport.EMPTY_TARGET_SOURCE) { throw new AopConfigException("No advisors and no TargetSource specified"); } this.advised = config; this.advisedDispatcher = new AdvisedDispatcher(this.advised); }
From source file:org.springframework.aop.framework.JdkDynamicAopProxy.java
/** * Construct a new JdkDynamicAopProxy for the given AOP configuration. * @param config the AOP configuration as AdvisedSupport object * @throws AopConfigException if the config is invalid. We try to throw an informative * exception in this case, rather than let a mysterious failure happen later. *///from w w w .java 2 s .c om public JdkDynamicAopProxy(AdvisedSupport config) throws AopConfigException { Assert.notNull(config, "AdvisedSupport must not be null"); if (config.getAdvisors().length == 0 && config.getTargetSource() == AdvisedSupport.EMPTY_TARGET_SOURCE) { throw new AopConfigException("No advisors and no TargetSource specified"); } this.advised = config; }
From source file:org.springframework.aop.framework.OptimizedJdkDynamicAopProxy.java
/** * Construct a new JDK proxy./*from w w w . j a v a 2 s . co m*/ * @throws AopConfigException if the config is invalid. We try * to throw an informative exception in this case, rather than let * a mysterious failure happen later. */ protected OptimizedJdkDynamicAopProxy(AdvisedSupport config) throws AopConfigException { if (config == null) throw new AopConfigException("Cannot create AopProxy with null ProxyConfig"); if (config.getAdvisors().length == 0 && config.getTargetSource() == AdvisedSupport.EMPTY_TARGET_SOURCE) throw new AopConfigException("Cannot create AopProxy with no advisors and no target source"); this.advised = config; this.advisors = config.getAdvisors(); if (!config.targetSource.isStatic()) { throw new AopConfigException("Can't use Optimized JDK proxy with non-static target source"); } if (config.exposeProxy) { throw new AopConfigException("Can't use Optimized JDK proxy if proxy needs to be exposed"); } try { // TODO must be frozen System.err.println("Caching lockable target"); this.target = config.targetSource.getTarget(); this.targetClass = target.getClass(); } catch (Exception ex) { throw new AopConfigException("Can't obtain target from static TargetSource", ex); } }