Besides the return type mode (CodeRet-type-pattern in the Part). All parts except the name mode and parameter mode are optional. The return type mode determines that the return type of the method must match a connection point in sequence. The most frequently used return type mode is*
It indicates matching any return type. Only the methods of the given type are returned. The name pattern matches the method name. You can use*
Wildcard characters are used as all or part of naming rules. The parameter mode is a bit complicated:()
Matches a method that does not accept any parameters, while(..)
Matches a method that accepts any number of parameters (zero or more ). Mode(*)
Matches a method that accepts any type of parameter. Mode(*, String)
Matches a method that accepts two parameters. The first method can be of any type, and the second method must be of the string type. See the language semantics section in the aspectj programming guide.
Below are some examples of common entry point expressions.
Execution of any public method:
Execution (Public **(..))
-
Execution of any method starting with "set:
Execution (* Set *(..))
-
Accountservice
Execution of any method of the interface:
Execution (* COM. XYZ. Service. accountservice .*(..))
-
Define the execution of any method in the service package:
Execution (* COM. XYZ. Service .*.*(..))
-
Define the execution of any method in the service package or sub-package:
Execution (* COM. XYZ. Service ..*.*(..))
-
Any connection points in the service package (only method execution in Spring AOP ):
Within (COM. XYZ. Service .*)
-
Any connection points in the service package or sub-package (only method execution in Spring AOP ):
Within (COM. XYZ. Service ..*)
ImplementedAccountservice
Any connection point of the proxy object of the interface (only method execution in Spring AOP ):
This (COM. XYZ. Service. accountservice)
'It' is used in binding form more:-see the section on how to enable proxy objects to be accessed in the notification body in the following sections.
-
ImplementedAccountservice
Any connection point of the target object of the interface (only method execution in Spring AOP ):
Target (COM. XYZ. Service. accountservice)
'Target' is used in binding form:-see the following section on how to make the target object accessible in the notification body.
Each parameter accepts only one parameter and is passed in at runtime.Serializable
Interface connection point (only method execution in Spring AOP)
ARGs (Java. Io. serializable)
'Args 'is used in binding form:-see the following section for details about how to make method parameters accessible in the notification body.
Note that the starting point in the example is different fromExecution (** (Java. Io. serializable ))
: ARGs matches the input parameter serializable only during dynamic running, while execution implements the signature declaration type of the input parameter.Serializable
Interface.
-
There is@ Transactional
Arbitrary connection points in the annotation target object (in Spring AOP, only method execution is performed)
@ Target (Org. springframework. transaction. annotation. Transactional)
'@ Target' can also be used in binding form: see the section in the notice section about how to make annotation objects accessible in the notification body below.
The declared type of any target object has one@ Transactional
Annotation connection point (only method execution in Spring AOP)
@ Within (Org. springframework. transaction. annotation. Transactional)
'@ Within' can also be used in binding form:-see the following sections for details about how to enable annotation objects to be accessed in the notification body.
-
Any method for execution has one@ Transactional
Annotation connection point (only method execution in Spring AOP)
@ Annotation (Org. springframework. transaction. annotation. Transactional)
'@ Annotation' can also be used in binding form:-see the following sections for details about how to enable an annotation object to be accessed in the notification body.
-
Any one accepts a parameter, in addition, the input parameter type implements the connection point of @ classified
annotation (in Spring AOP, only method execution is performed)
@ ARGs (COM. XYZ. security. classified)
'@ ARGs' can also be used in binding form: -The following section describes how to enable an annotation object to be accessed in the notification body.