MethodInterceptor-方法拦截器

MethodInterceptor

方法拦截器,也就是aop拦截方法

 

1.使用示例

public interface MethodInterceptor extends Interceptor {
      Object invoke(MethodInvocation invocation) throws Throwable;
}

只有一个方法invoke方法,这里和java web的过滤器很相像

Object ret = invocation.proceed();

在这个方法的前后加上逻辑,就是方法前和方法后需要执行的逻辑

posted @ 2017-12-04 12:09  我真的什么都不懂  阅读(7869)  评论(0编辑  收藏  举报