Spring Aop源码学习--Aop代理AopProxy
2017-07-07 18:22
381 查看
AopProxy是Spring Aop提供的代理类,简单来说通过其实现类可以获取到代理类。
AopProxy接口提供的方法如下:
public interface AopProxy {
/**
* Create a new proxy object.
* <p>Uses the AopProxy's default class loader (if necessary for proxy creation):
* usually, the thread context class loader.
* @return the new proxy object (never {@code null})
* @see Thread#getContextClassLoader()
*/
//获取一个代理对象
Object getProxy();
/**
* Create a new proxy object.
* <p>Uses the given class loader (if necessary for proxy creation).
* {@code null} will simply be passed down and thus lead to the low-level
* proxy facility's default, which is usually different from the default chosen
* by the AopProxy implementation's {@link #getProxy()} method.
* @param classLoader the class loader to create the proxy with
* (or {@code null} for the low-level proxy facility's default)
* @return the new proxy object (never {@code null})
*/
//根据类加载器获取代理对象
Object getProxy(ClassLoader classLoader);
}AopProxy有两个实现类JdkDynamicAopProxy和CglibAopProxy,简单来说这两个代理类的功能就是生成目标代理类,其实现机制可以参考 Java--Proxy代理介绍及实现机制。
AopProxy接口提供的方法如下:
public interface AopProxy {
/**
* Create a new proxy object.
* <p>Uses the AopProxy's default class loader (if necessary for proxy creation):
* usually, the thread context class loader.
* @return the new proxy object (never {@code null})
* @see Thread#getContextClassLoader()
*/
//获取一个代理对象
Object getProxy();
/**
* Create a new proxy object.
* <p>Uses the given class loader (if necessary for proxy creation).
* {@code null} will simply be passed down and thus lead to the low-level
* proxy facility's default, which is usually different from the default chosen
* by the AopProxy implementation's {@link #getProxy()} method.
* @param classLoader the class loader to create the proxy with
* (or {@code null} for the low-level proxy facility's default)
* @return the new proxy object (never {@code null})
*/
//根据类加载器获取代理对象
Object getProxy(ClassLoader classLoader);
}AopProxy有两个实现类JdkDynamicAopProxy和CglibAopProxy,简单来说这两个代理类的功能就是生成目标代理类,其实现机制可以参考 Java--Proxy代理介绍及实现机制。
相关文章推荐
- Spring源码分析----建立AopProxy代理对象和AOP拦截器的调用
- 【Spring源码--AOP的实现】(一)AopProxy代理对象的创建
- Spring AOP高级——源码实现(3)AopProxy代理对象之JDK动态代理的创建过程
- SPRING源码学习之路(三)——<aop:config>自动代理的实现
- Spring源码学习 ------ IoC——AOP
- Spring源码学习(二)------ AOP
- Spring AOP的实现之建立AopProxy代理对象
- Spring源码学习(二)------ AOP
- Spring AOP 学习之cJlib动态代理
- spring源码学习之路---AOP初探
- Spring4学习笔记-AOP前传之动态代理
- Spring源码学习(二)------ AOP
- spring 学习基础笔记 包括spring 的代理 JDK CGLIB 事物 AOP 以及各种注入
- Spring核心学习-AOP(7) 织入和代理
- Spring源码学习-5.AOP原理分析
- Spring中AOP原理,源码学习笔记
- 方法接口spring源码学习之路---深入AOP(终)
- spring源码学习之路---深入AOP(终)
- spring源码学习之路---深入AOP(终)
- 学习笔记--代理与AOP及实现类似SPRING的可配置的AOP框架