• 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);
    		}
    	}
    }
    
  • 相关阅读:
    区块链技术栈-区块链账本
    (引文)可扩展的分布式数据库架构
    CentOS7 通过systemd 添加开机重启服务
    spring发布RMI服务(-)
    使用jdbc连接上oracle的两种方法
    用户态和内核态
    MySQL数据库备份还原(基于binlog的增量备份)
    分布式事务
    shuffle 过程
    MapReduce的流程
  • 原文地址:https://www.cnblogs.com/sethxiong/p/15329873.html
Copyright © 2020-2023  润新知