AOP的规范本应该由SUM公司提出,但是被AOP联盟捷足先登.AOP联盟指定AOP规范,首先就要解决一个问题,怎么表示切入点,也就是在哪些方法上增强(where)

AspectJ 是一个面向切面的框架:

AspectJ切入点语法如下:
(表示在哪些包下的哪些类的哪些方法做切入增强)
execution(modifiners-pattern?ret-type-pattern declaring-type-pattern? name-param(param-patterm)throws-pattern?) ?
表示:该参数可以出现一次或零次
翻译成中文: execution(<修饰符>?<返回类型> <声明类型>?<方法名>(<参数>)<异常>?)
举例:public static Class java.lang.Class.forName(String className) throws ClassNotFoundException
 

通配符

*

匹配任何部分,只能表示一个单词

..

可用于全限定名中和方法参数中,分别表示子包和0到N个参数

spring-core 文档中的例子

Some examples of common pointcut expressions are given below.
the execution of any public method:
execution(public * *(..)) the execution of any method with a name beginning with "set":
execution(* set*(..)) the execution of any method defined by the AccountService interface:
execution(* com.xyz.service.AccountService.*(..))//常用 the execution of any method defined in the service package:
execution(* com.xyz.service.*.*(..))//常用 the execution of any method defined in the service package or a sub-package:
execution(* com.xyz.service..*.*(..))//常用

作者:小白201808
链接:https://www.jianshu.com/p/f82b6933d78f
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

Spring(5) -(14) pointcut 语法的更多相关文章

  1. Spring AOP中pointcut expression表达式解析

    Pointcut 是指那些方法需要被执行"AOP",是由"Pointcut Expression"来描述的. Pointcut可以有下列方式来定义或者通过&am ...

  2. spring aop中pointcut表达式完整版

    spring aop中pointcut表达式完整版 本文主要介绍spring aop中9种切入点表达式的写法 execute within this target args @target @with ...

  3. Spring AOP 中@Pointcut的用法

    Spring Aop中@pointCut的用法,格式:execution(modifiers-pattern? ret-type-pattern declaring-type-pattern? nam ...

  4. spring入门(14)

    AOP是一个新的专题,基础部分主要是入门 后续的五.六.七都属于AOP专题: 所以有必要对这三章要学什么有个全局的认识. 1 概要 1 什么是AOP及实现方式 介绍了AOP的用途,以及大致的实现方案 ...

  5. Spring系列14:IoC容器的扩展点

    Spring系列14:IoC容器的扩展点 回顾 知识需要成体系地学习,本系列文章前后有关联,建议按照顺序阅读.上一篇我们详细介绍了Spring Bean的生命周期和丰富的扩展点,没有阅读的强烈建议先阅 ...

  6. Spring Aop织入点语法

    Aspectj织入点语法: 1.execution(public * *(..))   任何类的任何返回值的任何方法 2.execution(* set*(..))       任何类的set开头的方 ...

  7. Spring AOP 切点(pointcut)表达式

    这遍文章将介绍Spring AOP切点表达式(下称表达式)语言,首先介绍两个面向切面编程中使用到的术语. 连接点(Joint Point):广义上来讲,方法.异常处理块.字段这些程序调用过程中可以抽像 ...

  8. 【spring AOP】@Pointcut的12种用法

    @Pointcut用来标注在方法上来定义切入点. 使用格式:@ 注解(value="表达标签 (表达式格式)").如:@Pointcut("execution(* com ...

  9. Spring AOP AspectJ Pointcut Expressions With Examples--转

    原文地址:http://howtodoinjava.com/spring/spring-aop/writing-spring-aop-aspectj-pointcut-expressions-with ...

随机推荐

  1. STL访问Map问题,key为Integer或Long

    参考stackoverflows上的这篇文章 http://stackoverflow.com/questions/924451/jstl-access-a-map-value-by-key 换成 原 ...

  2. 通过css 居中div的几种常用方法

    1.text-align:center方式 .center{ text-align:center; } center_text{ display:inline-block; width:500px } ...

  3. MySQL存储过程例子

    -- 索引 INDEXCREATE INDEX idx_sname ON student( sname(4)); ALTER TABLE teacher add index idx_tname(tna ...

  4. JAVA虚拟机:内存各个区介绍

    概述:java应用程序由java虚拟机自动管理程序执行期间内存管理. 优势:1.不再需要程序员去为使用的内存在程序中手动编写释放内存代码. 2.由虚拟机管理内存不容易出现内存泄漏和内存溢出的问题. 缺 ...

  5. KAZE特征和各向异性扩散滤波

    kaze feature: http://www.doc88.com/p-6911376909693.html 各向异性扩散滤波  Scale-space and edge detection usi ...

  6. 我的Grunt之旅-初识gruntfile文件

    时间:2018-03-06 18:23  事件:配置 gruntfile.js文件 首先,回忆一下之前的点,grunt项目下面必须有两个文件  ,第一个  package.json ,第二个  Gru ...

  7. 三十二、CI框架之配置域名和设置默认登陆网站

    一.打开routes.php文件,将$route['default_controller'] = 'login'; 修改成我们需要的内容. 二.修改config.php中的base_url数据 三.L ...

  8. POJ1723 SOLDIERS 兄弟连

    SOLDIERS 有一个性质:在一个长为n的序列a中找一个数 \(a_k\) 使得 \(\sum\limits_{i=1}^n abs(a_i-a_k)\) 最小,则 \(a_k\) 是a的中位数. ...

  9. Mysql 模糊查询 转义字符

    MySQL的转义字符“\” \0   一个ASCII  0  (NUL)字符.    \n    一个新行符.    \t    一个定位符.    \r    一个回车符.    \b    一个退 ...

  10. JDBC面试知识点整理(温习用)

    要面试,所以把之前的笔记整理一遍,嘻嘻,加油 JDBC编程 使用JDBC,java程序可以轻松地操作各种主流数据库,Oracle,MySQL,等,使用JDBC编写的程序不仅可以实现跨数据库,还具有跨平 ...