Skip to content

Commit

Permalink
Advice Type - @JoinPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
TinaXing2012 committed Nov 26, 2019
1 parent 423045b commit 999bacd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions springaop/src/main/java/xing/rujuan/aop/advices/LogAspect.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package xing.rujuan.aop.advices;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
Expand All @@ -9,13 +10,16 @@
@Component
public class LogAspect {

@Before("execution(* *(..))")
public void logBefore(){
System.out.println("Log before executing....");
@Before("execution(* xing.rujuan.aop.advices.AccountService.*(..))")
public void logBefore(JoinPoint joinPoint){
System.out.println("Log before executing...." + joinPoint.getSignature().getName());
System.out.println(joinPoint.getTarget().getClass().getName());
System.out.println("Args: " + joinPoint.getArgs()[0]);
System.out.println(joinPoint.getThis().getClass().getName());
}

@After("execution(* xing.rujuan.aop.advices.CustomerService.*(..))")
public void logAfter(){
public void logAfter(JoinPoint joinPoint){
System.out.println("Log After executing---");
}
}

0 comments on commit 999bacd

Please sign in to comment.