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))"
相关推荐
葫芦和十三6 小时前
图解 MongoDB 26|片键设计:决定集群命运的一个决定
后端·mongodb·agent
Avan_菜菜7 小时前
使用 Docker + rclone 自建 WebDAV
后端·agent·claude
阳光是sunny8 小时前
别再被 worktree 绕晕了!AI 编程时代你必须掌握的 Git 隔离神器
前端·人工智能·后端
万少10 小时前
万少的博客 - 技术分享与解决方案
前端·javascript·后端
咖啡八杯10 小时前
GoF设计模式——备忘录模式
java·后端·spring·设计模式
苍何10 小时前
腾讯再放大招,企微 Agent 大圆开启内测
后端
ethantan10 小时前
一篇讲解AI Agent 组成:像人一样思考的智能体
人工智能·后端·程序员
apocelipes12 小时前
常用编程语言和库的正则表达式性能对比
c语言·c++·python·性能优化·golang·开发工具和环境
Cosolar12 小时前
vLLM 生产级部署完全指南
人工智能·后端·架构
IT_陈寒13 小时前
垃圾回收器选错了,我的Java服务内存炸了
前端·人工智能·后端