@Component
@Aspect
public class AopTest {
//切面
@Pointcut("execution(* com.gao.demo_test.web.*.*(..))")
public void point(){ }
//@Before("point()")
public void before(){
System.out.println("前面");
}
//@After("point()")
public void After(){
System.out.println("后面");
}
//@AfterReturning(pointcut = "point()",returning = "o")
public void afterreturn(Object o){
System.out.println(o.toString());
}
@Around("point()")
public Object aroud(ProceedingJoinPoint j) throws Throwable {
return j.proceed();
}
}
aop的demo
最新推荐文章于 2024-04-28 10:58:37 发布