常见Pointcout
1.NameMatchMethodPointcut
NameMatchMethodPointcut pointcut =new NameMatchMethodPointcut();
pointcut.setMappedName("matches");
//或多个方法
pointcut.setMappedNames(new String[]{"matches","isRuntime"});
2.JdkRegexpMethodPointcut、Perl5RegexpMethodPointcut
JdkRegexpMethodPointcut pointcut=new JdkRegexpMethodPointcut();
pointcut.setPattern(".*match.*");
//或者
pointcut.setPatterns(new String[](".*match.*",".*matches"});
3.AnnotationMatchingPointcut
@ClassLevelAnnotation
public class GenericTargetObject{
@MethodLevelAnnotation
public void method1(){....};
public void method2(){....};
}
只匹配Class
AnnotationMatchingPointcut pointcut=new AnnotationMatchingPointcut(
ClassLevelAnnotation.class);
或者用静态方法
AnnotationMatchingPointcut pointcut=AnnotationMatchingPointcut.forClassAnnotation(
ClassLevelAnnotation.class);
只匹配Method
AnnotationMatchingPointcut pointcut=new AnnotationMatchingPointcut(
MethodLevelAnnotation.class);
或者用静态方法
AnnotationMatchingPointcut pointcut=AnnotationMatchingPointcut.forMethodAnnotation(
MethodLevelAnnotation.class);
匹配Class及Method
AnnotationMatchingPointcut pointcut=new AnnotationMatchingPointcut(
ClassLevelAnnotation.class,MethodLevelAnnotation.class);
4.ComposablePointcut
5.定制Pointcut
继承StaticMethodMatcherPointcut
继承DynamicMethodMatcherPointcut
分享到:
相关推荐
SPRING 笔记SPRING 笔记SPRING 笔记
spring笔记 狂神说
spring笔记.pdf
spring 初学 笔记 入门提示
达内,tarena,spring笔记,springPPT课件,达内spring笔记 spring的全套资料
spring入门笔记
Spring笔记 Spring笔记 Spring笔记 Spring笔记 Spring笔记
尚硅谷Spring笔记
Spring笔记示例源代码
我在学校时整理的笔记,从不懂时到懂,因为时间紧,要找工作,所以整理不好的请谅解,如果需要一些其它资料的,可以找我,这是我的邮箱zhj915946763@163.com,我有java基础的,spring,hibernate,Struts2,svn,xml,...
Spring学习笔记,Spring就是一个工厂,可以将所有对象创建和依赖关系维护,交给spring管理
网上获取的简单关于spring的一些学习笔记, 包括 spring, springMVC, spring cloud, springBoot 和一些其他相关的笔记, 有需要的可以看看
狂神的spring讲解资料,已汇总成PDF笔记,并加了章节标签方便阅读
适合听狂神课的人和刚学框架的人
Spring笔记和小结Spring笔记和小结Spring笔记和小结Spring笔记和小结
Spring快速入门,知识收费
传智播客左慈老师培训的spring笔记,压缩包里面包含四天的笔记