Created
          April 8, 2019 02:35 
        
      - 
      
 - 
        
Save moods445/ffee863ea92112c8efdf172e82ddec54 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
moods445 created this gist
Apr 8, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; @Aspect public class AopSample{ private Logger logger = LoggerFactory.getLogger(this.getClass()); @Pointcut("exection()") public void executeTime() { } @Around("executeTime()") public Object around(ProceedingJoinPoint joinPoint) throws Throwable { long startTime = System.currentTimeMillis(); try { return joinPoint.proceed(); } finally { long timeTaken = System.currentTimeMillis() - startTime; logger.info("Time Taken({} ms) by {}", timeTaken, joinPoint); } } }