Declaring Advice (interceptor)

The next step is to define Advice. This is an action performed on a join-point. Advice is also referred as an interceptor. Spring AOP supports various types of Advice, as shown here:

  • Before Advice: This type of Advice is executed just before the execution starts at the join-point. In the case of an exception, Spring will stop further execution of this Advice.
  • After Advice: As its name suggests, this type of Advice is executed after completion of join-point execution (either a normal exit, or in the case of an exception, from the join-point).
  • Around Advice: This type of Advice is executed around the join-point (before and/or after the advised method). Because of this, you have the control to execute the join-point ...

Get Java 9 Dependency Injection now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.