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))"
相关推荐
金銀銅鐵4 小时前
类实例里还有什么——putfield、getfield 与对象传递
java·jvm·后端
织码weavecodes4 小时前
Spring Boot 接入 AI 图像生成:模型适配、图片转存与 Redis 清理
人工智能·spring boot·redis
xurileidian5 小时前
第 24 篇 · 边玩边学Python · while 与死循环怎么退
服务器·前端·python
皮皮林5515 小时前
你还在使用 WebSocket 实现实时消息推送吗?
后端
有个傻瓜5 小时前
工具调用参数每次都差一截:finish_reason=length 输出预算截断的排错复盘与四种分诊实测
python·故障排查·ai agent·大模型应用开发·function calling
码事漫谈5 小时前
token账单到底要怎么看
后端
zhanghongyi_cpp6 小时前
第5章 学习自测
python·学习
Cosolar6 小时前
当 Harness 标准化后,工程师还剩什么?
人工智能·后端·agent
打工仔折腾 AI6 小时前
L3 静态源码取证|工程评测:python-oracledb 驱动评估中的样本偏差陷阱
开发语言·人工智能·后端·python·性能优化
stark张宇7 小时前
分布式事务方案设计与选型思考:消息队列
后端