Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.qs.aop; import com.qs.service.PostService; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; /** * * @author qius */ @Aspect public class AspectJAop { // execution(* com.qs..*.*(..)) @Before("execution(* com.qs..*.*(..))") public void beforeTurnToHomePage() { System.out.println("######################AspectJAopTest######################"); } @Before("this(postService)") public void bindProxyObj(PostService postService) { System.out.println("I get the service"); } @Around("execution(* com.qs.controller.PostController.testJson1(..))") public void aroundHotel(ProceedingJoinPoint pjp) throws Throwable { System.out.println("?"); pjp.proceed(); } }