SpringBoot AOP切入点表达式

介绍

在AOP中可以通过注解来定义 切入点表达式来控制被监控的方法。

匹配所有 com.example.service 包下以 Service 结尾的方法:

java 复制代码
"execution(* com.example.service.*Service.*(..))"

匹配任意类的 public 方法:

java 复制代码
"execution(public * *(..))"

匹配 com.example.service 包及其子包下的任意方法:

java 复制代码
"execution(* com.example.service..*.*(..))"

匹配 MyService 类中的 doSomething 方法:

java 复制代码
"execution(* com.example.service.MyService.doSomething(..))"

匹配 com.example.service 包中的任何类的 save 方法,且方法参数为 java.lang.String 类型

yaml 复制代码
"execution(* com.example.service.*.save(java.lang.String))"
相关推荐
To_OC21 小时前
Next.js + Redis 构建笔记系统:Redis Hash 实战与性能优化
redis·后端·next.js
安_21 小时前
如何构建和使用向量索引?HNSW 和 IVF 有什么区别?
python·ai
counting money1 天前
Java IO流详解:从InputStream到文件操作实战
java·开发语言·python
坚持学习前端日记1 天前
Python SQLAlchemy ORM 从0到1精通实战手册(基础到复杂高阶)
数据库·python·oracle
北斗落凡尘1 天前
LangGraph 入门实战(11)--输出模式
后端·python·langchain
雪碧聊技术1 天前
安装Python(保姆级教程)
python·版本更新·python下载
++==1 天前
JSON和Python的 四种核心容器
python·json
demo007x1 天前
Hermes-Agent 技术架构
前端·后端·agent
__zRainy__1 天前
Node系列 · Node基础:net 模块
后端·node.js