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(); }
  • 相关阅读:
    freemarker list集合去重,实现hashset
    freemarker特殊字符输出
    idea java 注释模板配置
    IntelliJ IDEA使用eclipse compiler(ecj)解决lombok编译问题
    odoo views
    python 内置函数 3.6版本
    iostat
    性能及优化之 vmstat
    python 基础
    git
  • 原文地址:https://www.cnblogs.com/whm-blog/p/11098807.html
Copyright © 2011-2022 走看看