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).

Comment From: sjohnr

Thanks @ch-beck! I think it makes sense to make the XML and Java/Kotlin consistent with AspectJExpressionPointcut (though I haven't personally tried the example as you have). Would you be interested in submitting a PR to adjust the Java/Kotlin examples?

Comment From: andreilisa

Hello @sjohnr , can I fix it ?

Comment From: sjohnr

@andreilisa Yes, it's yours!

Comment From: sjohnr

Closed via 1d769b5afccc5a31fe140de0ecbc1e8e08c70984