public static Method getMethod(JoinPoint joinPoint) {
        Method method = null;
        String name = joinPoint.getSignature().getName();

        try {
        // 这才是 正统!
            MethodSignature signature = (MethodSignature) joinPoint.getSignature();
            Class[] types = signature.getParameterTypes();

            joinPoint.getSignature();
            method = joinPoint.getTarget().
                    getClass().getMethod(name,types);
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
        return method;
    }

 多个连接点--

@Before("@annotation(cloud.cjy.travel.module.common.annotation.CjyAspect) || within(@cloud.cjy.travel.module.common.annotation.CjyAspect *)")

或者:

private static MethodSignature getMethodSignature(JoinPoint joinPoint) {
Signature signature = joinPoint.getSignature();
return (MethodSignature) signature;
}



public
static Method getMethod(JoinPoint joinPoint) { MethodSignature methodSignature = getMethodSignature(joinPoint); return methodSignature.getMethod(); }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2021-05-20
  • 2022-12-23
  • 2021-11-29
  • 2021-08-02
  • 2021-06-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
  • 2021-10-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案