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))"
相关推荐
f***686025 分钟前
【SpringBoot篇】详解Bean的管理(获取bean,bean的作用域,第三方bean)
java·spring boot·后端
z***75151 小时前
【Springboot3+vue3】从零到一搭建Springboot3+vue3前后端分离项目之后端环境搭建
android·前端·后端
电子_咸鱼3 小时前
【STL string 全解析:接口详解、测试实战与模拟实现】
开发语言·c++·vscode·python·算法·leetcode
w***95493 小时前
SQL美化器:sql-beautify安装与配置完全指南
android·前端·后端
哈茶真的c3 小时前
【书籍心得】左耳听风:传奇程序员练级攻略
java·c语言·python·go
橙子家4 小时前
Serilog 日志库简单实践(三)集中式日志与分析平台 Sinks(.net8)
后端
io_T_T4 小时前
Paddle-CLS图像分类_环境安装
python·日常软硬件经验分享
r***12384 小时前
Spring boot启动原理及相关组件
数据库·spring boot·后端
m***11904 小时前
【SpringBoot】Spring Boot 项目的打包配置
java·spring boot·后端