liveBook · Manning

Pointcut

As explained in Spring Start Here, Second Edition

A pointcut is a specification of the methods whose execution is intercepted for aspect application.

A pointcut specifies which method calls Spring intercepts for an aspect. It answers which methods; advice answers when the aspect logic runs, such as before or after a call. section 6.1

Spring AOP join points are method calls. A pointcut identifies the calls to intercept, while Spring applies the aspect through a proxy around the target bean. 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.

The diagram distinguishes the pointcut’s selected method from the advice that determines when aspect logic runs. section 6.1

How Spring Start Here, Second Edition covers it

How deep it goes
Defines pointcuts and distinguishes them from advice, but does not explain pointcut syntax.
What you can do after
Understand which method calls a pointcut selects for aspect interception.
How it connects
Connects pointcuts to aspects, advice, join points, target objects, and weaving.

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.