liveBook · Manning

Advice

As explained in Spring Start Here, Second Edition

Advice is aspect logic together with the execution timing at which that logic runs relative to an intercepted operation.

Advice specifies when aspect logic runs relative to a method call, such as before, after, or around it. A pointcut selects the methods to intercept; advice sets the timing. section 6.1

Figure 6.2 The aspect terminology: Spring executes some logic (the aspect) when someone calls a specific method (the pointcut). We need to specify when the logic is executed according to the pointcut (e.g., before). The when is the advice. For Spring to intercept the method, the object that defines the intercepted method needs to be a bean in the Spring context. So, the bean becomes the target object of the aspect.

Use the terminology diagram to distinguish advice timing from the aspect logic and the pointcut. section 6.1

How Spring Start Here, Second Edition covers it

How deep it goes
Defines advice through before, after, and around timing without detailing their implementation.
Examples
Uses before, after, and around a method call as timing examples.
What you can do after
Understand how aspect logic is timed relative to intercepted method calls.
How it connects
Connects advice with aspects, pointcuts, and join points in Spring AOP.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Start Here, Second Edition. The section links point to the parts of the book it draws on.