• Java spring aop Around


    package com.hh.aop;

    import org.aspectj.lang.ProceedingJoinPoint;
    import org.aspectj.lang.annotation.Around;
    import org.aspectj.lang.annotation.Aspect;
    import org.aspectj.lang.annotation.Before;
    import org.aspectj.lang.reflect.MethodSignature;
    import org.springframework.stereotype.Component;

    @Aspect
    @Component
    public class LogAop {

    // private EntityManager entityManager;

    @Around("execution(* com.hh.controller..*.*(..))")
    public Object aopController(ProceedingJoinPoint joinPoint) throws Throwable {

    System.out.println("around");
    //获取方法参数值数组
    Object[] args = joinPoint.getArgs();
    //得到其方法签名
    MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
    //获取方法参数类型数组
    Class[] paramTypeArray = methodSignature.getParameterTypes();
    System.out.println(methodSignature.getParameterNames());
    System.out.println(paramTypeArray);
    Object result = joinPoint.proceed(args);
    System.out.println("=====checkSecurity====");

    for (int i = 0; i < joinPoint.getArgs().length; i++) {
    System.out.println(joinPoint.getArgs()[i]);
    }
    System.out.println(joinPoint.getSignature().getName());



    return result;
    }
    }
  • 相关阅读:
    containerd 与安全沙箱的 Kubernetes 初体验
    dubbo-go 中的 TPS Limit 设计与实现
    MVC
    DataGridView移动上下行
    Jquery hover 事件
    MVC
    MVC 基本概念
    AJAX简单封装
    ViewState
    PostBack
  • 原文地址:https://www.cnblogs.com/honghong75042/p/14274344.html
Copyright © 2020-2023  润新知