#-#
#-# Pointcut
#-#
A pointcut is a program element that picks out join points and exposes data from the execution context of those join points.
Pointcuts are used primarily by advice. They can be composed with boolean operators to build up other pointcuts.
any type and number of args ββ
method ββ β
class ββ β β
β β β
@Pointcut(“execution(public * com.demo..(..))”)
β β β
β β ββ any return type
β ββ access modifier
ββ designator
#-# Pointcut designators
Type Designator Description
method call The pointcut will find all methods that calls a method in the demo package.
method execution The pointcut will find all methods in the demo package.
method withincode All the statements inside the methods in the demo package.
type within All statements inside the a class that ends with Test.
field get All reads to jdbcTemplate fields of type JdbcTemplate in the integration.db package. Includes all methods on this field if itβs an object.
field set When you set the jdbcTemplate field of type JdbcTemplate in the integration.db package to a new value.
@Pointcut("[method designator](* aspects.trace.demo..(..))")
public void traceMethodsInDemoPackage() {}
@Pointcut("type designator")
public void inTestClass() {}
@Pointcut("[field designator](private org.springframework.jdbc.core.JdbcTemplate integration.db.*.jdbcTemplate)")
public void jdbcTemplateGetField() {}