切点打印:被切的类名、方法名、方法参数值、方法参数类型等

private void printMethod(JoinPoint joinPoint, String name) throws NoSuchMethodException {
    MethodSignature signature = (MethodSignature) joinPoint.getSignature();
    Class<?> clazz = joinPoint.getTarget().getClass();
    Method method = clazz.getMethod(signature.getName(), signature.getParameterTypes());
    System.out.printf("[MethodLogAspect]切面 %s 打印 -> [className]:%s  ->  [methodName]:%s  ->  [methodArgs]:%s%n", name, clazz.getName(), method.getName(), Arrays.toString(joinPoint.getArgs()));
}

https://blog.csdn.net/scm_2008/article/details/128593857

posted @ 2024-01-15 15:51  裸奔到月球  阅读(7)  评论(0编辑  收藏  举报