zoukankan      html  css  js  c++  java
  • Spring AOP

    类关系图

    image-20210923070023607

    • AopProxyFactory
    public interface AopProxyFactory {
    
    	/**
    	 * Create an {@link AopProxy} for the given AOP configuration.
    	 * @param config the AOP configuration in the form of an
    	 * AdvisedSupport object
    	 * @return the corresponding AOP proxy
    	 * @throws AopConfigException if the configuration is invalid
    	 */
    	AopProxy createAopProxy(AdvisedSupport config) throws AopConfigException;
    
    }
    
    • DefaultAopProxyFactory
    public class DefaultAopProxyFactory implements AopProxyFactory, Serializable {
    
    	@Override
    	public AopProxy createAopProxy(AdvisedSupport config) throws AopConfigException {
    		if (config.isOptimize() || config.isProxyTargetClass() || hasNoUserSuppliedProxyInterfaces(config)) {
    			Class<?> targetClass = config.getTargetClass();
    			if (targetClass == null) {
    				throw new AopConfigException("TargetSource cannot determine target class: " +
    						"Either an interface or a target is required for proxy creation.");
    			}
          // 代理对象是接口 或者是 JDK Proxy 代理后的对象,则使用动态代理
    			if (targetClass.isInterface() || Proxy.isProxyClass(targetClass)) {
    				return new JdkDynamicAopProxy(config);
    			}
          // 否则使用 Cglib(代码生成库)
    			return new ObjenesisCglibAopProxy(config);
    		}
    		else {
    			return new JdkDynamicAopProxy(config);
    		}
    	}
    }
    
  • 相关阅读:
    前端网站汇总
    更换Sublime Text主题字体
    免费收录网站搜索引擎登录口
    IE6,7,8支持css圆角
    CSS继承—深入剖析
    JavaScript正则表达式大全
    CSS伪元素选择器
    line-height用法总结
    判断腾讯QQ是否在线
    text-overflow使用文字超多div的宽度或超过在table中<td>
  • 原文地址:https://www.cnblogs.com/sethxiong/p/15329873.html
Copyright © 2011-2022 走看看