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 小时前
Go 如何打印调试深层或嵌套的结构体
开发语言·后端·golang
红烧大青虫4 小时前
HarmonyOS应用开发实战:小事记 - 数据迁移策略:RDB 表结构变更的版本号管理与 onUpgrade 回调
后端·华为·harmonyos·鸿蒙系统
geovindu5 小时前
go: Iterative Algorithms
开发语言·后端·算法·golang·迭代算法
郭老二6 小时前
【Python】基本语法:装饰器语法糖@
python
阳光是sunny6 小时前
LangGraph实战教程:defer延迟节点——让收尾工作自动排到最后
前端·人工智能·后端
前端工作日常6 小时前
我学习到的Java中domain和dto区别
java·后端
kite01216 小时前
Go语言Map深度解析与最佳实践
开发语言·后端·golang
阳光是sunny6 小时前
LangGraph实战教程:控制流详解
前端·人工智能·后端
码农学院6 小时前
基于Spring Boot的跨境电商多语言订单管理系统架构设计
java·大数据·spring boot
_Jimmy_7 小时前
Agent常用检索器的详细介绍
python·langchain