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(); }
  • 相关阅读:
    Git 上传本地项目
    virtual和override
    ASP .NET依赖注入理解
    dotnet不是内部或外部的命令,也不是可运行的程序或批处理文件
    C++ 简单选择排序
    C++ 排序
    iOS UIDynamic
    iOS Modal
    C++ 折半查找
    C++ 二叉链表
  • 原文地址:https://www.cnblogs.com/whm-blog/p/11098807.html
Copyright © 2011-2022 走看看