如何获得方法的执行时间?是否有Timer实用程序类用于计算任务需要多长时间等等?
Google上的大多数搜索会返回计划线程和任务的计时器的结果,这不是我想要的.
我想为带有方法注释的方法设置AspectJ切入点@Scheduled。尝试了不同的方法,但没有任何效果。
1.)
@Pointcut("execution(@org.springframework.scheduling.annotation.Scheduled * * (..))")
public void scheduledJobs() {}
@Around("scheduledJobs()")
public Object profileScheduledJobs(ProceedingJoinPoint joinPoint) throws Throwable {
LOG.info("testing")
}
Run Code Online (Sandbox Code Playgroud)
2.)
@Pointcut("within(@org.springframework.scheduling.annotation.Scheduled *)")
public void scheduledJobs() {}
@Pointcut("execution(public * *(..))")
public void publicMethod() {}
@Around("scheduledJobs() && publicMethod()")
public Object profileScheduledJobs(ProceedingJoinPoint joinPoint) throws Throwable {
LOG.info("testing")
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以提出任何其他方式都around/ before上建议@Scheduled注解的方法?