首页 > 编程语言 > 详细

spring aop中引介拦截器的用法

时间:2020-01-10 22:01:25      阅读:159      评论:0      收藏:0      [点我收藏+]
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;
 } 
}

 

spring aop中引介拦截器的用法

原文:https://www.cnblogs.com/nizuimeiabc1/p/12178259.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!