zoukankan      html  css  js  c++  java
  • aspectj 获取 连接点 方法!

    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(); }
  • 相关阅读:
    js的alert乱码问题
    (6)select语句
    (5)视图
    (4)索引
    (3)操作数据库
    (2)MySQL数据类型
    (1)MySQL概述
    RocketMQ安装使用
    uniapp打包h5
    面试必问 如何保证缓存与数据库的一致性
  • 原文地址:https://www.cnblogs.com/whm-blog/p/11098807.html
Copyright © 2011-2022 走看看