【发布时间】:2021-09-07 22:42:48
【问题描述】:
我正在使用 Spring AOP 记录 DB 执行时间,但它适用于整个方法执行时间。
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface TrackExecutionTime {
}
Is there any possibility that we can use this @TrackExecutionTime not in the method level but inside a method just above some statement like below -
@TrackExecutionTime
List<Release> releaseList = releaseRepo.findByProductName(productName.toUpperCase());
这样我就可以只获取数据库执行时间,而不仅仅是整个方法执行时间,因为我的方法还包含其他业务逻辑,其中还包括我们是否在方法级别使用 AOP 注释。
【问题讨论】:
标签: spring spring-boot aop spring-aop