3

I have a point cut for all classes in Spring AOP like

@Pointcut("execution(* com.company.app..*(..))")

Now I need to exclude a class say com.company.app.IgnoreClass. Can someone please help me write the pointcut?

JD7
  • 45
  • 1
  • 5

1 Answers1

6

The Pointcut to exclude all methods in IgnoreClass would be:

@Pointcut("execution(* com.company.app..*(..)) && !execution(* com.company.app.IgnoreClass.*(..)) ")

Documentation about pointcuts expression here, also more related information on Spring AOP declaring pointcuts here.

Leandro Carracedo
  • 7,233
  • 2
  • 44
  • 50
  • In case of XML, this expression would be `"execution(* com.company.app..*(..)) && !execution(* com.company.app.IgnoreClass.*(..)) "` – Vijay Nandwana Mar 27 '18 at 10:48