spring aop中引介拦截器的用法

public class Other implements IntroductionInterceptor,IOther{
 public void doOther(){
  System.out.println("Other对象的功能");
 }
 
 public Object invoke(MethodInvocation methodInvocation) throws Throwable {
  if(implementsInterface(methodInvocation.getMethod().getDeclaringClass())){
   return methodInvocation.getMethod().invoke(this, methodInvocation.getArguments());
  }
  else{
   return methodInvocation.proceed();
  }
 }
 public boolean implementsInterface(Class arg0){
  boolean assignableFrom = arg0.isAssignableFrom(IOther.class);
  return assignableFrom;
 } 
}
原文地址:https://www.cnblogs.com/nizuimeiabc1/p/12178259.html