@Before("execution(public int lzj.com.spring.aop.ArithmeticCalculator.*(int, int))") public void beforMethod(JoinPoint point){ String methodName = point.getSignature().getName(); List<Object> args = Arrays.asList(point.getArgs()); System.out.println("调用前连接点方法为:" + methodName + ",参数为:" + args); }
调用前连接点方法为:add,参数为:[3, 2] add->result:5 调用前连接点方法为:div,参数为:[4, 2] div->result:2