daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package net.javabeat.spring.data.aspect;
  2.  
  3.  
  4. import org.aspectj.lang.ProceedingJoinPoint;
  5. import org.aspectj.lang.annotation.Around;
  6. import org.aspectj.lang.annotation.Aspect;
  7. import org.springframework.stereotype.Component;
  8. import java.util.Date;
  9.  
  10. @Aspect
  11. @Component
  12. public class MyAspect {
  13.     @Around("execution(* net.javabeat.spring.data.service.BookServiceImpl.*(..))")
  14.     public Object doThing(final ProceedingJoinPoint thisJoinPoint) throws Throwable {
  15.         final String joinPointName = thisJoinPoint
  16.                 .getThis()
  17.                 .getClass()
  18.                 .getSimpleName() + "." + thisJoinPoint.getSignature()
  19.                 .getName() + "()";
  20.         Date date = new Date();
  21.         System.out.println("Entering [" + joinPointName + "]");
  22.         System.out.println("Entered at: " + date.toString());
  23.        
  24.         Object retVal = thisJoinPoint.proceed();
  25.  
  26.         System.out.println("Leaving  [" + joinPointName + "]");
  27.         return retVal;
  28.     }
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top