Commit 2cd4bdfa by zhangxingmin

push

parent d7498be6
package com.yd.csf.service.config;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
@Aspect
@Component
@Slf4j
public class MethodTimeAspect {
@Around("execution(* com.yd.csf.service..*.*(..))")
public Object measure(ProceedingJoinPoint pjp) throws Throwable {
long start = System.currentTimeMillis();
Object result = pjp.proceed();
long cost = System.currentTimeMillis() - start;
log.info("【性能】{}.{} 耗时 {} ms",
pjp.getTarget().getClass().getSimpleName(),
pjp.getSignature().getName(),
cost);
return result;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment