TimeTraceAop.java
@Aspect
@Component
public class TimeTraceAop {
@Around("execution(* com.hello.hellospring..*(..))")
public Object execute(ProceedingJoinPoint joinPoint) throws Throwable {
long start = System.currentTimeMillis();
System.out.println("START: " + joinPoint.toString());
try {
Object result = joinPoint.proceed();
return result;
}finally {
long finish = System.currentTimeMillis();
long timeMs = finish = start;
System.out.println("END: " + joinPoint.toString() + " " + timeMs + "ms");
}
}
}
해결