于梦想齐行
于梦想齐行

@Aspect中5种通知

@Aspect中5种通知

1.Before

前置通知,在方法执行之前执行。连接点参数:JoinPoint,对应通知:AspectJMethodBeforeAdvice。

2.After

后置通知,在方法执行之后执行,无论目标方法是否产生异常都会被执行。连接点参数:JoinPoint,对应通知:AspectJAfterAdvice。

3.AfterReturning

返回通知,在方法返回结果之后执行,目标方法有抛出异常则不执行。连接点参数:JoinPoint,对应通知:AspectJAfterReturningAdvice。

4.AfterThrowing

异常通知:在目标方法抛出异常之后执行。连接点参数:JoinPoint,对应通知:AspectJAfterThrowingAdvice。

5.Around

环绕通知:围绕着方法执行,可实现以上4种通知。连接点参数:ProceedingJoinPoint,对应通知:AspectJAroundAdvice。

# #
首页      计算机      Java      Spring      @Aspect中5种通知

于梦想齐行

@Aspect中5种通知
1.Before 前置通知,在方法执行之前执行。连接点参数:JoinPoint,对应通知:AspectJMethodBeforeAdvice。 2.After 后置通知,在方法执行之后执行,无论目标方法是否产生异常都…
扫描二维码继续阅读
2022-03-07
近期文章
近期评论