메소드에 타이머를 추가하기 위해 코스튬 어노테이션이있는 AOP를 사용하고 있습니다.aop을 사용하여 예외 처리
@Around(value = "@annotation(benchmark)")
public void func(final ProceedingJoinPoint joinPoint, final Benchmark benchmark) throws Throwable {
//wrap the call to the method with timer
final long t0 = System.currentTimeMillis();
logger.error(t0 + " ");
joinPoint.proceed();
final long elapsed = (System.currentTimeMillis() - t0);
logger.error(elapsed + " ");
}
주석이 달린 메소드에서 예외가 발생하면 무엇인가 할 수 있기를 원합니다. 내가 올바른 방법이 무엇인지 잘 모르겠습니다 ...
내가 읽고 있다는 것을 보았다 :
@AfterThrowing(pointcut = "execution(* com.mycompany.package..* (..))", throwing = "ex")
지금까지 내가 @AfterThrowing
내가, 내가 필요로 원하는 걸 포기하지 않는 이해 어떻게 든 벤치 마크 주석으로 주석 처리 된 메소드에서만 예외를 캐시합니다.
아이디어가 있으십니까?
감사합니다.