如何快速通过url定位到controller中的方法(采用AOP)

aspect 拦截controller显示指明

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import java.lang.reflect.Modifier;

/**
 *
 */

@Component
@Aspect
public class HttpRequestAspect {

   @Pointcut("execution(* com.hikvision..*.controller..*.*(..))")
   public void httpRequestLog() {}


   @Around("httpRequestLog()")
   public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
      Object data = joinPoint.proceed(joinPoint.getArgs());

      System.out.println("目标方法名为:" + joinPoint.getSignature().getName());
      System.out.println("目标方法所属类的简单类名:" + joinPoint.getSignature().getDeclaringType().getSimpleName());
      System.out.println("目标方法所属类的类名:" + joinPoint.getSignature().getDeclaringTypeName());
      System.out.println("目标方法声明类型:" + Modifier.toString(joinPoint.getSignature().getModifiers()));

      return data;
   }
}

你可能感兴趣的:(如何快速通过url定位到controller中的方法(采用AOP))