MethodInterceptor-方法攔截器


MethodInterceptor

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

 

1.使用示例

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

只有一個方法invoke方法,這里和java web的過濾器很相像

Object ret = invocation.proceed();

在這個方法的前后加上邏輯,就是方法前和方法后需要執行的邏輯


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM