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))"
相关推荐
IT 行者1 分钟前
Spring Security Session 序列化策略分析
java·spring boot·后端·spring
AI云原生2 分钟前
如何解决 pip install 代理报错 SOCKS5 握手失败 ReadTimeoutError 问题
网络·爬虫·python·网络协议·tcp/ip·scikit-learn·pip
IT 行者4 分钟前
Spring Boot 4.0 整合Spring Security 7 后的统一异常处理指南
spring boot·后端·spring
学博成1 小时前
在 Spring Boot 中使用 Kafka 并保证顺序性(Topic 分区为 100)的完整案例
spring boot·kafka
無欲無为2 小时前
Spring Boot 整合 RabbitMQ 详细指南:从入门到实战
spring boot·rabbitmq·java-rabbitmq
掘根2 小时前
【消息队列项目】客户端四大模块实现
开发语言·后端·ruby
cnxy1888 小时前
围棋对弈Python程序开发完整指南:步骤4 - 提子逻辑和劫争规则实现
开发语言·python·机器学习
NAGNIP8 小时前
多个 GitHub 账户SSH 密钥配置全攻略
后端
NAGNIP8 小时前
Windows命令行代码自动补全详细步骤
后端
TheSumSt9 小时前
Python丨课程笔记Part3:语法进阶部分(控制结构与基础数据结构)
数据结构·笔记·python