AOP JoinPoint 获取方法属性 参数名称值Map对象

时间:2025-03-23 16:20:25
@Pointcut("execution(* .*.list*(..))") public void pointCut() { } @Before(value = "pointCut()") private Map<String, Object> getFieldsName(JoinPoint joinPoint){ MethodSignature methodSignature = (MethodSignature) (); //方法所属类的类名 String ClassName = (); //获取当前切点方法对象 Method method = (); //打印方法名 (()); //方法参数的类型 Class<?>[] parameterTypes = (); for (Class<?> clas : parameterTypes) { String parameterName = (); ("参数类型:" + parameterName); } Map<String, Object> map = new HashMap<String, Object>(); //参数名称 String[] names=((MethodSignature) ()).getParameterNames(); //参数值 Object[] objects=(); for (int i = 0; i < ; i++) { (names[i], objects[i]); } return map; }