相关疑难解决方法(0)

如何计算方法在Java中的执行时间?

如何获得方法的执行时间?是否有Timer实用程序类用于计算任务需要多长时间等等?

Google上的大多数搜索会返回计划线程和任务的计时器的结果,这不是我想要的.

java timing

792
推荐指数
26
解决办法
65万
查看次数

具有@Scheduled Spring批注的方法的切入点

我想为带有方法注释的方法设置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注解的方法?

java spring aspectj spring-scheduled

5
推荐指数
1
解决办法
2128
查看次数

标签 统计

java ×2

aspectj ×1

spring ×1

spring-scheduled ×1

timing ×1