Description
In current the documentation for Matching Methods with Custom Pointcuts there are examples of custom pointcut in Java/Kotlin and XML which should be equivalent.
While the XML variant works and is currently used by us, the Java example doesn't work.
As far as I understand, the pointcut pattern in the example is an AspectJ pointcut but the class used is JdkRegexpMethodPointcut
. Trying to run the example as is results in
java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 10
execution(* com.mycompany.*Service.*(..))
^
Swapping the JdkRegexpMethodPointcut
for AspectJExpressionPointcut
(and replacing pattern.setPattern()
with pattern.setExpression()
) results in a working app with expected behaviour.
The example should therefore probably either use AspectJExpressionPointcut
(with pattern.setExpression()
) or a different pattern (which would make the XML example not equivalent anymore).