Rys
Rys

Reputation: 5154

Is posible to use the method name with a wildcard with aop?

I want to create a point cut using part of a method name and a wildcard, for example:

myMethodWrite()

So my idea is something like that:

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

Is something like this possible?

Upvotes: 2

Views: 1273

Answers (1)

Sotirios Delimanolis
Sotirios Delimanolis

Reputation: 279990

Yes, it is possible. The Spring AOP documentation states

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

and gives an example

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

 execution(* set*(..))

Upvotes: 4

Related Questions