java joinpoint教程_java – 使用aspectJ在AOP中连接点VS进行JoinPoint?

任何人可以告诉我,Joinpoint和Proceedingjoinpoint有什么区别?

何时在方面的类方法中使用Joinpoint和Proceedingjoinpoint?

我在AspectJ类中使用了JoinPoint,

@Pointcut("execution(* com.pointel.aop.test1.AopTest.beforeAspect(..))")

public void adviceChild(){}

@Before("adviceChild()")

public void beforeAdvicing(JoinPoint joinPoint /*,ProceedingJoinPoint pjp - used refer book marks of AOP*/){

//Used to get the parameters of the method !

Object[] arguments = joinPoint.getArgs();

for (Object object : arguments) {

System.out.println("List of parameters : " + object);

}

System.out.println("Method name : " + joinPoint.getSignature().getName());

log.info("beforeAdvicing...........****************...........");

log.info("Method name : " + joinPoint.getSignature().getName());

System.out.println("************************");

}

但有些我在其他资源中看到的是,

@Around("execution(* com.mumz.test.spring.aop.BookShelf.addBook(..))")

public void aroundAddAdvice(ProceedingJoinPoint pjp){

Object[] arguments = pjp.getArgs();

for (Object object : arguments) {

System.out.println("Book being added is : " + object);

}

try {

pjp.proceed();

} catch (Throwable e) {

e.printStackTrace();

}

}

在这里,与“JointPoint”相比,ProceedingJoinPoint会做什么呢?

pjp.proceed()会为我们做什么?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值