码迷,mamicode.com
首页 > 编程语言 > 详细

spring---aop(3)---Spring AOP的拦截器链

时间:2017-07-10 18:06:58      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:动态   ota   method   odi   zab   一点   san   获取   his   

写在前面

  时间断断续续,这次写一点关于spring aop拦截器链的记载。至于如何获取spring的拦截器,前一篇博客已经写的很清楚(spring---aop(2)---Spring AOP的JDK动态代理

 

获取拦截器链

final class JdkDynamicAopProxy implements AopProxy, InvocationHandler, Serializable {

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        ...
       //获取拦截器链   List
<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass); // Check whether we have any advice. If we don‘t, we can fallback on direct if (chain.isEmpty()) { // 如果拦截器链为空,则执行目标方法 retVal = AopUtils.invokeJoinpointUsingReflection(target, method, args); } else { // 封装拦截器链的执行方法 invocation = new ReflectiveMethodInvocation(proxy, target, method, args, targetClass, chain); // 拦截器链执行 retVal = invocation.proceed(); }
     ... }

 

spring---aop(3)---Spring AOP的拦截器链

标签:动态   ota   method   odi   zab   一点   san   获取   his   

原文地址:http://www.cnblogs.com/chihirotan/p/7146586.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!