spring aop代码顺序梳理

1、构建切面

org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator#postProcessBeforeInstantiation(AbstractAutoProxyCreator-->AnnotationAwareAspectJAutoProxyCreator)
-->
org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator#shouldSkip
-->
org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator#findEligibleAdvisors
-->
org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator#findCandidateAdvisors
-->
org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper#findAdvisorBeans
-->
org.springframework.aop.aspectj.annotation.BeanFactoryAspectJAdvisorsBuilder#buildAspectJAdvisors
-->
org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory#getAdvisors(AspectJAdvisorFactory-->ReflectiveAspectJAdvisorFactory)
-->
org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory#getAdvisorMethods
-->
org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory#getAdvisor
-->
org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory#getPointcut(返回AspectJExpressionPointcut)
-->
org.springframework.aop.aspectj.annotation.InstantiationModelAwarePointcutAdvisorImpl#InstantiationModelAwarePointcutAdvisorImpl(调用构造方法,Advisor-->PointcutAdvisor-->InstantiationModelAwarePointcutAdvisor-->InstantiationModelAwarePointcutAdvisorImpl)
-->
org.springframework.aop.aspectj.annotation.InstantiationModelAwarePointcutAdvisorImpl#instantiateAdvice
-->
org.springframework.aop.aspectj.annotation.ReflectiveAspectJAdvisorFactory#getAdvice

2、创建代理对象

org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator#postProcessAfterInitialization(AbstractAutoProxyCreator-->AnnotationAwareAspectJAutoProxyCreator)
-->
org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator#wrapIfNecessary
-->
org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator#shouldSkip
-->
org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator#findEligibleAdvisors
-->
org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator#findCandidateAdvisors
-->
org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper#findAdvisorBeans
-->
org.springframework.aop.aspectj.annotation.BeanFactoryAspectJAdvisorsBuilder#buildAspectJAdvisors
-->
org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator#getAdvicesAndAdvisorsForBean
-->
org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator#findEligibleAdvisors
-->
org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator#findCandidateAdvisors
-->
org.springframework.aop.framework.autoproxy.BeanFactoryAdvisorRetrievalHelper#findAdvisorBeans
-->
org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator#findAdvisorsThatCanApply
-->
org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator#extendAdvisors
-->
org.springframework.aop.aspectj.AspectJProxyUtils#makeAdvisorChainAspectJCapableIfNecessary(额外增加ExposeInvocationInterceptor)
-->
org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator#sortAdvisors(切面排序)
-->
org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator#createProxy(创建代理对象)
-->
org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator#buildAdvisors
-->
org.springframework.aop.framework.adapter.DefaultAdvisorAdapterRegistry#wrap(创建DefaultPointcutAdvisor关联advice,AdvisorAdapterRegistry-->DefaultAdvisorAdapterRegistry)
-->
org.springframework.aop.framework.AdvisedSupport#addAdvisors(Advisor... advisors)(设置AOP关联的advisor列表)
-->
org.springframework.aop.framework.ProxyFactory#getProxy(java.lang.ClassLoader)
-->
org.springframework.aop.framework.ProxyCreatorSupport#getAopProxyFactory(获取DefaultAopProxyFactory,AopProxyFactory-->DefaultAopProxyFactory)
-->
org.springframework.aop.framework.DefaultAopProxyFactory#createAopProxy(返回JdkDynamicAopProxy或者ObjenesisCglibAopProxy)
-->
org.springframework.aop.framework.AopProxy#getProxy(java.lang.ClassLoader)(返回代理对象)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值