Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. package com.pig.spring.springaop.springaop.aspect;
  2.  
  3. import org.aspectj.lang.ProceedingJoinPoint;
  4. import org.aspectj.lang.annotation.Around;
  5. import org.aspectj.lang.annotation.Aspect;
  6. import org.slf4j.Logger;
  7. import org.slf4j.LoggerFactory;
  8. import org.springframework.context.annotation.Configuration;
  9.  
  10. @Aspect
  11. @Configuration
  12. public class MethodExecutionCalculationAspect {
  13.  
  14. private Logger logger = LoggerFactory.getLogger(this.getClass());
  15.  
  16. @Around("execution(* com.pig.spring.springaop.springaop.business.*.*(..))")
  17. public void around(ProceedingJoinPoint joinPoint) throws Throwable {
  18. long startTime = System.currentTimeMillis();
  19. joinPoint.proceed();
  20. long timeTaken = System.currentTimeMillis() - startTime;
  21. logger.info("Time taken is {} is {}",joinPoint,timeTaken);
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement