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))"
相关推荐
不做Java程序猿好多年6 分钟前
Java中 String、StringBuffer、StringBuilder 的区别详解
开发语言·python
金銀銅鐵14 分钟前
[Python] 用 turtle 来绘制国际象棋棋盘(不含棋子)
python·游戏
這花開嗎17 分钟前
2026年TTS文字转语音API哪家强?批量自动化配音成本与技术实测
python·flask·自动化
江湖十年28 分钟前
Go 语言中 YAML to JSON 踩坑笔记
后端·go·json
笨蛋不要掉眼泪30 分钟前
Java虚拟机:常用参数
java·开发语言·python
2501_909509101 小时前
DAY 31
python
李昊哲小课1 小时前
FastAPI 猫咖预约系统 API
人工智能·python·fastapi
你驴我1 小时前
WhatsApp 消息撤回与编辑的幂等性设计实践
java·服务器·前端·后端·python
一缕清烟在人间1 小时前
HarmonyOS开发实战:小分享-TextEditPage文字编辑器——Header+TextArea+工具栏
后端·华为·harmonyos·鸿蒙
人间凡尔赛1 小时前
K8s 十年之变:从 Cloud Native 到 AI Native,2026 年后端架构的范式革命
后端·云原生·架构