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))"
相关推荐
林小帅12 小时前
NestJS v11 + Prisma v7 ESM 迁移配置解析
前端·javascript·后端
IT_陈寒12 小时前
React的setState竟然不是立刻生效的,害我调试半天
前端·人工智能·后端
逝水无殇14 小时前
C# 字符串(String)详解
开发语言·后端·c#
神奇小汤圆14 小时前
牛客网Java八股文|2026秋招面试题汇总(金九银十冲刺专用)
后端
cfm_291414 小时前
SpringBoot MockMvc
spring boot·后端·log4j
神奇小汤圆14 小时前
你的Java天花板,不是Spring Boot,是思维方式
后端
梨子同志14 小时前
Maven
后端
用户416596736935515 小时前
堡垒机 Web CLI 部署教程
后端
xiyueyezibile15 小时前
“自迭代” Skill 的 team-pitfalls 的演进
前端·后端·ai编程
叫我少年15 小时前
C# StringBuilder 基础入门
后端