Jor*_*rdi 4 spring spring-aop spring-boot
我编写了这段代码:
@Aspect
@Component
public class ApiAuditAspect {
@Pointcut(value = "execution(* net.gencat.transversal.espaidoc.api.controller.RepositoryController.*(..))")
public void anyRepositoryController() {
// Nothing to do here
}
@AfterReturning(
pointcut = "anyRepositoryController()",
returning = "result")
public void audit(JoinPoint point, Object result) throws Throwable {
// audit actions
}
@After("anyRepositoryController()")
public void flush() {
// flush all audits
}
}
Run Code Online (Sandbox Code Playgroud)
我意识到flush之前已经被执行过audit。
我虽然@After是在之后被处决的AfterReturning。
关于如何解决这个问题有什么想法吗?
小智 6
从 Spring 5.2 开始。(2020 年 6 月 9 日发布)@After 建议方法在同一方面类中的任何 @AfterReturning 或 @AfterThrowing 建议方法之后调用
https://github.com/spring-projects/spring-framework/issues/25186
| 归档时间: |
|
| 查看次数: |
4892 次 |
| 最近记录: |