spring aop表达式详解

2023-10-31

本文转载自点击打开链接

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..*.*(..))
  • any join point (method execution only in Spring AOP) within the service package:

  • within(com.xyz.service.*)
  • any join point (method execution only in Spring AOP) within the service package or a sub-package:

    within(com.xyz.service..*)
  • any join point (method execution only in Spring AOP) where the proxy implements the AccountService interface:

    this(com.xyz.service.AccountService)

    'this' is more commonly used in a binding form :- see the following section on advice for how to make the proxy object available in the advice body.

  • any join point (method execution only in Spring AOP) where the target object implements the AccountService interface:

    target(com.xyz.service.AccountService)

    'target' is more commonly used in a binding form :- see the following section on advice for how to make the target object available in the advice body.

  • any join point (method execution only in Spring AOP) which takes a single parameter, and where the argument passed at runtime is Serializable:

    args(java.io.Serializable)

    'args' is more commonly used in a binding form :- see the following section on advice for how to make the method arguments available in the advice body.

    Note that the pointcut given in this example is different to execution(* *(java.io.Serializable)): the args version matches if the argument passed at runtime is Serializable, the execution version matches if the method signature declares a single parameter of type Serializable.

  • any join point (method execution only in Spring AOP) where the target object has an @Transactional annotation:

    @target(org.springframework.transaction.annotation.Transactional)

    '@target' can also be used in a binding form :- see the following section on advice for how to make the annotation object available in the advice body.

  • any join point (method execution only in Spring AOP) where the declared type of the target object has an @Transactional annotation:

    @within(org.springframework.transaction.annotation.Transactional)

    '@within' can also be used in a binding form :- see the following section on advice for how to make the annotation object available in the advice body.

  • any join point (method execution only in Spring AOP) where the executing method has an @Transactional annotation:

    @annotation(org.springframework.transaction.annotation.Transactional)

    '@annotation' can also be used in a binding form :- see the following section on advice for how to make the annotation object available in the advice body.

  • any join point (method execution only in Spring AOP) which takes a single parameter, and where the runtime type of the argument passed has the @Classified annotation:

    @args(com.xyz.security.Classified)

    '@args' can also be used in a binding form :- see the following section on advice for how to make the annotation object(s) available in the advice body.

  • any join point (method execution only in Spring AOP) on a Spring bean named 'tradeService':

    bean(tradeService)
  • any join point (method execution only in Spring AOP) on Spring beans having names that match the wildcard expression '*Service':

    bean(*Service)

对应的中文:

任意公共方法的执行: 
execution(public * *(..)) 
任何一个以“set”开始的方法的执行: 
execution(* set*(..)) 
AccountService 接口的任意方法的执行: 
execution(* com.xyz.service.AccountService.*(..)) 
定义在service包里的任意方法的执行: 
execution(* com.xyz.service.*.*(..)) 
定义在service包或者子包里的任意方法的执行: 
execution(* com.xyz.service..*.*(..)) 
在service包里的任意连接点(在Spring AOP中只是方法执行) : 
within(com.xyz.service.*) 
在service包或者子包里的任意连接点(在Spring AOP中只是方法执行) : 
within(com.xyz.service..*) 
实现了 AccountService 接口的代理对象的任意连接点(在Spring AOP中只是方法执行) : 
this(com.xyz.service.AccountService) 
'this'在binding form中用的更多:- 请常见以下讨论通知的章节中关于如何使得代理对象可以在通知体内访问到的部分。 
实现了 AccountService 接口的目标对象的任意连接点(在Spring AOP中只是方法执行) : 
target(com.xyz.service.AccountService) 
'target'在binding form中用的更多:- 请常见以下讨论通知的章节中关于如何使得目标对象可以在通知体内访问到的部分。 
任何一个只接受一个参数,且在运行时传入的参数实现了 Serializable 接口的连接点 (在Spring AOP中只是方法执行) 
args(java.io.Serializable) 
'args'在binding form中用的更多:- 请常见以下讨论通知的章节中关于如何使得方法参数可以在通知体内访问到的部分。 请注意在例子中给出的切入点不同于 execution(* *(java.io.Serializable)): args只有在动态运行时候传入参数是可序列化的(Serializable)才匹配,而execution 在传入参数的签名声明的类型实现了 Serializable 接口时候匹配。 
有一个 @Transactional 注解的目标对象中的任意连接点(在Spring AOP中只是方法执行) 
@target(org.springframework.transaction.annotation.Transactional) 
'@target' 也可以在binding form中使用:请常见以下讨论通知的章节中关于如何使得annotation对象可以在通知体内访问到的部分。 
任何一个目标对象声明的类型有一个 @Transactional 注解的连接点(在Spring AOP中只是方法执行) 
@within(org.springframework.transaction.annotation.Transactional) 
'@within'也可以在binding form中使用:- 请常见以下讨论通知的章节中关于如何使得annotation对象可以在通知体内访问到的部分。 
任何一个执行的方法有一个 @Transactional annotation的连接点(在Spring AOP中只是方法执行) 
@annotation(org.springframework.transaction.annotation.Transactional) 
'@annotation' 也可以在binding form中使用:- 请常见以下讨论通知的章节中关于如何使得annotation对象可以在通知体内访问到的部分。 
任何一个接受一个参数,并且传入的参数在运行时的类型实现了 @Classified annotation的连接点(在Spring AOP中只是方法执行) 
@args(com.xyz.security.Classified)


本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

spring aop表达式详解 的相关文章

  • C++ 构造函数初始化调用顺序及类函数内部嵌套函数情况

    一 C 构造函数初始化顺序 C 构造函数按下列顺序被调用 1 2 3 4是按照优先级顺序来的 1 任何虚拟基类的构造函数按照它们被继承的顺序构造 2 任何非虚拟基类的构造函数按照它们被继承的顺序构造 3 任何成员对象的构造函数按照它们声明的
  • Apex类格式

    例子
  • 自动化测试之Selenium

    https www cnblogs com ldd215 p 5549984 html 文章目录 python常用操作 0 1 获取Excel中的数据 0 2 截取图片 第一章 第一讲 自动化测试概述 1 1什么是软件测试 1 2什么是自动
  • 【 力扣(LeetCode)刷题详细介绍】

    转载于 东心十 关于leetcode刷题详细介绍 虽然刷题一直饱受诟病 不过不可否认刷题确实能锻炼我们的编程能力 相信每个认真刷题的人都会有体会 现在提供在线编程评测的平台有很多 比较有名的有 hihocoder LintCode 以及这里
  • Google浏览器安装插件

    以安装 沙拉查词 插件为例 1 先点击Google浏览器右上方三个小点 找到 设置 将搜索引擎改为Bing 2 然后就可以使用新建页面了 在新建页面搜索 极简插件 或 扩展迷 搜索 沙拉查词 并下载 下载下来是一个压缩包 解压之后可以找到里
  • dnf安徒恩服务器不稳定,DNF安徒恩开团后掉线那些事 网友:这时才体会到混子的重要性...

    原标题 DNF安徒恩开团后掉线那些事 网友 这时才体会到混子的重要性 DNF安徒恩副本难度对于目前的玩家来说并不难 所以很多人追求极限人数开团 有时是12人 有时甚至是10人 于是问题来了 有人掉线怎么办 一起来看看大家在安徒恩的遭遇 玩家
  • 华为2018秋招笔试——将一段压缩后的字符串解压缩,并且排序输出

    题目描述 将一段压缩后的字符串解压缩 并且排序输出 解压规则 每个字符串后面跟随一个数字 表示这个字符串的重复次数 例如 a5 解压缩的结果为 aaaaa abc3 解压缩后的结果为 abcabcabc 排序规则 1 根据每个字符串的重复次
  • 详解拷贝构造函数

    基本规则 拷贝构造函数是一种特殊的构造函数 函数的名称必须和类名称一致 它必须的一个参数是本类型的一个引用变量 所以类中可以存在多个拷贝构造函数 编译器会自动生成默认构造函数 这个构造函数很简单 仅仅使用 老对象 的数据成员的值对 新对象
  • PyTorch(Python)训练MNIST模型移动端IOS上使用Swift实时数字识别

    识别手写数字是计算机视觉的基石问题 可以通过神经网络来解决 在此 我不会重复有关模型构建和训练的细节 本文中 我的目的是将经过训练的模型移植到移动环境中 我使用 pytorch 构建模型 因为我想尝试一下 torchscript 对于 io
  • 山东大学项目实训开发日志——基于vue+springboot的医院耗材管理系统(14)

    我们解决了一个逻辑上的问题 1 医院向供货商下单 如果供货商一时不能提供足够的数量 应该怎么办 2 科室库向中心库提交申请 如果中心库库存不满足申请的数量 应该怎么办 经过一番讨论 对于第一个问题 后端的负责人表示 应该有一个功能 允许供货

随机推荐

  • ESP8266-01S系列学习笔记-01模块基本知识

    1 产品概述 ESP8266是乐鑫科技生产的一款内置WiFi功能的单片机 它有很多种型号 这些型号分别对应了不同的封装 ESP8266是一款超低功耗的UART WiFi 透传模块 拥有业内极富竞争力的封装尺寸和超低能耗技术 专为移动设备和物
  • 【实战教程】在小程序中快速生成分享海报

    在小程序中生成分享海报是一个很常见的需求 目前主要有以下两种做法 直接由前端生成 使用小程序提供的 canvas API 由后端知晓云 云函数 生成 前端再获取 本文将介绍通过知晓云 云函数 来生成分享海报的功能 并使用 webpack 和
  • ElasticSearch学习笔记(4)· ES IK分词器

    目录 九 IK中文分词器 1 在线安装IK中文分词器 2 本地安装IK中文分词器 3 扩展词 4 停用词 5 配置远程词典 6 分词器总结 九 IK中文分词器 NOTE 默认ES中采用标准分词器进行分词 这种方式并不适用于中文网站 因此需要
  • 基于unity+高通AR项目的一些总结

    今天 公司做的第一款AR项目终于在苹果appstore上架了 将近三个多月的踩坑和摸索也终于告一段落了 接下来就是不断的进行版本优化和更新 这将是一个漫长的过程 在此 对自己三个多月的开发做一个阶段性的总结 也希望能够帮到一些正在用unit
  • 【算法图解】 之 [贪婪算法(贪心算法)] 详解

    入门算法学习 看的第一本是深入浅出的 算法图解 一书 本博客是对 算法图解 一书的学习笔记 将书中的分享的算法示例用Python3语言实现 如果你也想要阅读这本书 百度云盘链接 https pan baidu com s 1s967vfgE
  • Java企业级应用常采用哪些系统架构?

    架构 又名软件架构 是有关软件整体结构与组件的抽象描述 用于指导大型软件系统各个方面的设计 Java企业级的应用根据业务的复杂程度 通常使用的系统架构有应用架构 垂直应用架构 面向服务的架构 Service Oriented Archite
  • Mybatis 使用标签时遇到的一个问题与标签的使用

    欢迎访问本人博客查看原文 http wangnan tech 今天遇到一个场景需要写一个这样的查询语句 用户对象userInfo包含下面几个字段 userName phone email qqId weiboId wxId 现在新注册用户
  • 手把手带你入门深度学习(一):保姆级Anaconda和PyTorch环境配置指南

    手把手带你入门深度学习 一 保姆级Anaconda和PyTorch环境配置指南 一 前言和准备工作 1 1 python anaconda和pytorch的关系 二 Anconda安装 2 1 安装 anaconda 2 2 更改pip源和
  • 2021-04-26(全网最简单)Centos8安装最新版本RabbitMQ和erlang

    1 首先进入rabbitmq官网 找到如图所示位置 2 进入到下载和安装页面 找到安装向导 3 选择CentOS点进去 意思是说有两种方法可以安装最新版本的RabbitMQ 使用Package Cloud或Bintray上的Yum存储库安装
  • [483]tensorflow模型保存和读取tf.train.Saver

    目标 训练网络后想保存训练好的模型 以及在程序中读取以保存的训练好的模型 首先 保存和恢复都需要实例化一个 tf train Saver saver tf train Saver 然后 在训练循环中 定期调用 saver save 方法 向
  • 让木桶没有短板,FISCO BCOS全面推进区块链并行化改造

    FISCO BCOS是完全开源的联盟区块链底层技术平台 由金融区块链合作联盟 深圳 简称金链盟 成立开源工作组通力打造 开源工作组成员包括博彦科技 华为 深证通 神州数码 四方精创 腾讯 微众银行 亦笔科技和越秀金科等金链盟成员机构 代码仓
  • 文件传输的几种常用方法

    文件传输的常用方式 http wget ftp tftp powershell apt get install python pyftpdlib python m pyftpdlib p 22 ftp 127 0 0 1 用户名 anony
  • python&selenium自动化测试实战项目(完整、全面)

    前言 之前的文章说过 要写一篇自动化实战的文章 这段时间比较忙再加回家过11一直没有更新博客 今天整理一下实战项目的代码共大家学习 注 项目是针对我们公司内部系统的测试 只能内部网络访问 外部网络无法访问 问 1 外部网络无法访问 代码也无
  • Kerberos安全认证-连载9-访问Kerberos安全认证Hadoop

    目录 1 Shell访问HDFS 2 Windows访问Kerberos认证HDFS 3 代码访问Kerberos认证的HDFS 技术连载系列 前面内容请参考前面连载8内容 Kerberos安全认证 连载8 Hadoop Kerberos安
  • 手动启动mysql数据库_MySql数据库教程 - 2.启动与关闭

    MySql服务的启动 右键计算机 管理 服务和应用程序 服务 右键 MySQL80 可以启动 停止MySQL 也可以点击属性 改变启动类型 手动 自动 自动启动状态下 每次打开计算机都会自动启动 MySql Workbench的启动 方式一
  • 中国-省-市三级地图及世界地图在线编辑可视化工具上线

    站点介绍 这是一个完全独立的站点 定位为一个数据分析可视化工具集合 每个子页面对应一个工具 目前主要上线了中国地图和世界地图可视化编辑工具 且听我一一道来 站点地址 中国地图 世界地图 中国地图 这是一个中国 省 直辖市 地级市 区 三级联
  • python实现Redis的订阅与发布(sub-pub机制)

    redis server win10 下载地址 https github com tporadowski redis releases cd D TOOLS redis服务器 Redis x64 5 0 14 redis server ex
  • 表面计量封闭型高斯滤波器(Matlab代码实现)

    欢迎来到本博客 博主优势 博客内容尽量做到思维缜密 逻辑清晰 为了方便读者 座右铭 行百里者 半于九十 本文目录如下 目录 1 概述 2 运行结果 3 参考文献 4 Matlab代码实现 1 概述 ISO 16610 21 封闭轮廓高斯滤波
  • Open3D(C++) Ransac拟合二维圆(详细过程版)

    目录 一 算法原理 二 代码实现 三 结果展示 一 算法原理 见 PCL RANSAC拟合二维圆 二 代码实现 include
  • spring aop表达式详解

    本文转载自点击打开链接 Some examples of common pointcut expressions are given below the execution of any public method execution pu