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))"
相关推荐
汪小成10 小时前
Go 项目结构总是写乱?这个 50 行代码的 Demo 教你标准姿势
后端·go
while(1){yan}10 小时前
Mybatis基础(详解)
spring boot·spring·java-ee·mybatis
ada7_10 小时前
LeetCode(python)78.子集
开发语言·数据结构·python·算法·leetcode·职场和发展
Piper蛋窝10 小时前
AI 有你想不到,也它有做不到 | 2025 年深度使用 Cursor/Trae/CodeX 所得十条经验
前端·后端·代码规范
我送炭你添花11 小时前
Pelco KBD300A 模拟器:06+5.串口实现的逻辑优化、配置管理与协议完善(二次迭代)
python·运维开发
databook11 小时前
前注意加工:让你的图表抓住读者的眼球
python·数据分析·数据可视化
知行学思11 小时前
Python配置管理完全指南:从dotenv到pydantic_settings
数据库·python·fastapi·环境变量·配置管理·pydantic·dotenv
一直都在57211 小时前
Spring框架:AOP
java·后端·spring
sheji341611 小时前
【开题答辩全过程】以 基于springboot的健身房管理系统为例,包含答辩的问题和答案
java·spring boot·后端
nbsaas-boot11 小时前
Go 项目中如何正确升级第三方依赖(Go Modules 实战指南)
开发语言·后端·golang