SpringAOP学习笔记--JoinPoint

 

SpringAOP学习笔记
1、Spring AOP 中的 JoinPoint 只支持方法执行的JoinPoint
2、Spring AOP 中的 Pointcut
org.springframework.aop.Pointcut为Pointcut的最顶层抽象。

package org.springframework.aop;
public interface Pointcut {
 ClassFilter getClassFilter();
 MethodMatcher getMethodMatcher();
 Pointcut TRUE = TruePointcut.INSTANCE;
}

getClassFilter和MethodMatcher分别用于匹配将被织入的操作对象以及相应的方法。

package org.springframework.aop;
public interface ClassFilter {
 //如果clazz与我们关注的现象相符时返回true,负责返回false
 boolean matches(Class<?> clazz);
 //静态参数 如果类型对于我们要扑捉的Pointcut来说无所谓,我们可讲此参数传递给Pointcut
 ClassFilter TRUE = TrueClassFilter.INSTANCE;
}
package org.springframework.aop;
public interface MethodMatcher {
 boolean matches(Method method, Class<?> targetClass);

 /**
  * 是否对参数值敏感
  * 如果为false表明匹配时不需要判断参数值(参数值不敏感),称之为StaticMethodMatcher,这时只有
  * matches(Method method, Class<?> targetClass); 被执行,执行结果可以缓存已提高效率。
  * 如果为true表明匹配时需要判断参数值(参数值敏感),称之为DynamicMethodMatcher,这时先执行
  * matches(Method method, Class<?> targetClass);如果返回true,然后再执行
  * boolean matches(Method method, Class<?> targetClass, Object[] args);已做进一步判断
  * 
  */
 boolean isRuntime();
 boolean matches(Method method, Class<?> targetClass, Object[] args);
 MethodMatcher TRUE = TrueMethodMatcher.INSTANCE;
}


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值