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))"
相关推荐
Csvn29 分钟前
安装、升级与目录结构
后端·nginx
皮皮林5511 小时前
万能通用!权限系统就该这么设计
后端
Warson_L1 小时前
高性能架构设计
python·go
databook2 小时前
新数据到手,先跑哪几步检查
python·数据分析
RuoyiOffice2 小时前
SpringBoot+Vue3 凭证生命周期设计:审核、过账、冲销与反过账怎样保持账目一致
java·spring boot·事务·springboot3·财务系统·会计凭证·ruoyi office
GoAI2 小时前
DeepSeek Harness Memory (一)主流记忆插件总结
后端·算法·面试
czq_26867194872 小时前
Python打卡第46天
开发语言·python
橙子家3 小时前
RESTful 接口:它并非标准或协议,而是一种【架构风格】
后端
RuoyiOffice3 小时前
KubeSphere 容器云实践:从管理 K8s 到建设企业 PaaS,还需要哪些能力
spring boot·kubernetes·kubesphere·jenkins·paas·微服务部署·ruoyi office
小兔子4 小时前
dict.get 的默认值每次都会求值,哪怕键本来就在
后端