-
JoinPoint和ProceedingJoinPoint的区别:**
JoinPoint类型的参数对于非环绕通知而言,环绕通知使用ProceedingJoinPoint。@Pointcut("execution( * com.springboot.chapter4.aspect.service.impl.UserServiceImpl.printUser(..))") public void pointcut() { } @Before("pointcut()") public void beforeParam(JoinPoint point) { Object[] args = point.getArgs(); System.out.println("args" + args); System.out.println("Before......"); } @Around("pointcut()") public void around(ProceedingJoinPoint jp) throws Throwable { System.out.println("around before......"); Object[] args = jp.getArgs(); System.out.println("args"+args); jp.proceed(); System.out.println("around after......"); }
-
将请求参数转化为字符串
private String argsToString(Object... args) { return Arrays.toString(args); }
SpringAop
最新推荐文章于 2022-07-21 16:46:54 发布