import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
/**
* handler调用前通用方法
*/
@Component
@Aspect
public class CommonInterceptor {
/*
*前置通知 对com.foo.external.oa.service.impl 目录下execute()方法织入
*/
@Before("execution(* com.foo.external.oa.service.impl.*.execute(..))")
public void beforeMethod(JoinPoint joinPoint) throws Throwable {
}
/*
*环绕通知 对com.foo.external.oa.service.impl 目录下的execute织入
*/
@AfterThrowing(value="execution(* com.foo.external.oa.service.impl.*.execute(..))", throwing="ex")
public void afterThrowing(JoinPoint joinPoint, Exception ex) throws Throwable{
}
}
spring 注解实现AOP
最新推荐文章于 2024-03-31 16:08:53 发布