package integration.anyframe.services.aop.aspect.aspectj; import org.aspectj.lang.Signature; import com.sds.emp.user.services.UserVO; public aspect PrintStringUsingAspctJ { pointcut getMethods(): execution(public * integration.anyframe.services..*Impl.get*(..)); before() : getMethods() { Class targetClass = thisJoinPoint.getTarget().getClass(); Signature signature = thisJoinPoint.getSignature(); String opName = signature.getName(); System.out.println("Before Advice of PrintStringUsingAspctJ"); System.out.println("***" + targetClass + "." + opName + "()" + "***"); } after() returning(UserVO retVal) : getMethods() { Class targetClass = thisJoinPoint.getTarget().getClass(); Signature signature = thisJoinPoint.getSignature(); String opName = signature.getName(); System.out .println("AfterReturning Advice of PrintStringUsingAspctJ"); System.out.println("***" + targetClass + "." + opName + "()" + "***"); } after() throwing(Exception exception) : getMethods() { Class targetClass = thisJoinPoint.getTarget().getClass(); Signature signature = thisJoinPoint.getSignature(); String opName = signature.getName(); System.out .println("AfterThrowing Advice of PrintStringUsingAspctJ"); System.out.println("***" + targetClass + "." + opName + "()" + "***"); } after() : getMethods() { Class targetClass = thisJoinPoint.getTarget().getClass(); Signature signature = thisJoinPoint.getSignature(); String opName = signature.getName(); System.out .println("After(finally) Advice of PrintStringUsingAspctJ"); System.out.println("***" + targetClass + "." + opName + "()" + "***"); } }