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))"
相关推荐
Code哈哈笑1 小时前
Idea连接远程云服务器上的MySQL,开放云服务器端口
服务器·后端·mysql·spring
网络风云1 小时前
Flask(补充内容)配置SSL 证书 实现 HTTPS 服务
python·https·flask·ssl
图南随笔2 小时前
Spring Boot(二十二):RedisTemplate的List类型操作
windows·spring boot·list
暴力袋鼠哥5 小时前
基于YOLO11的车牌识别分析系统
python
牛角挣扎录7 小时前
Spring事件监听:无法接收List<event>?
spring boot·spring
满怀10157 小时前
【Python进阶】列表:全面解析与实战指南
python·算法
奇谱8 小时前
Quipus,LightRag的Go版本的实现
开发语言·后端·语言模型·golang·知识图谱
Asthenia04128 小时前
ThreadLocal:介绍、与HashMap的对比及深入剖析
后端
小小菜鸟,可笑可笑8 小时前
Python 注释进阶之Google风格
开发语言·python