gpt4 book ai didi

java - 是否可以在 aop 中使用带有通配符的方法名称?

转载 作者:行者123 更新时间:2023-12-02 04:14:05 24 4
gpt4 key购买 nike

我想使用方法名称的一部分和通配符创建切点,例如:

myMethodWrite()

所以我的想法是这样的:

@Pointcut("execution(* br.com.spring.aop.*myMethod*.*(..))")

这样的事情可能吗?

最佳答案

是的,这是可能的。 Spring AOP documentation

The name pattern matches the method name. You can use the * wildcard as all or part of a name pattern.

并给出一个例子

the execution of any method with a name beginning with "set":

 execution(* set*(..))

关于java - 是否可以在 aop 中使用带有通配符的方法名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33505225/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com