1

I am trying to write a point cut for all void methods of classes that are annotated by @Service.

At first I tried to create two separate point cuts and then join them on advice calls but even that didnt work as I think I do not know the right format of the void method point cut declaration.

I had the following:

@Pointcut("execution(void * *(..))")
    public void voidMethodPointcut() {}

But this throws malformed pointcut expression Exception.

I am new to Spring and would really appreciate your help on this.

Nick Div
  • 5,338
  • 12
  • 65
  • 127

1 Answers1

0

For methods annotated by @Service your pointcut expression should look like this:

execution(@your.package.name.Service void *.*(..))

And for all methods of classes annotated by @Service - like this:

execution(void (@your.package.name.Service *).*(..))
Eugene Kuleshov
  • 31,461
  • 5
  • 66
  • 67