Spring execution expression, springexecution

Source: Internet
Author: User

Spring execution expression, springexecution

Execution (modifiers-pattern? Ret-type-pattern declaring-type-pattern? Name-pattern (param-pattern) throws-pattern ?)
Except for the return type mode (ret-type-pattern in the code snippet above), the name mode and parameter mode are all optional. The return type mode determines that the return type of the method must match a connection point in sequence. The most frequent return type pattern you will use is *, which indicates matching any return type. Only the methods of the given type are returned. The name pattern matches the method name. You can use the * wildcard as the all or part of the naming mode. The parameter mode is a little complicated: () matches a method that does not accept any parameters, and (...) matches a method that accepts any number of parameters (zero or more ). The mode (*) matches a method that accepts any type of parameters. The 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.

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 *(..))
Execute any method of the AccountService 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 ..*)
Any connection point of the proxy object that implements the AccountService interface (in Spring AOP, only method execution is performed ):
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.
Any connection point of the target object implementing the AccountService interface (in Spring AOP, only method execution is performed ):
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 that accepts only one parameter implements the connection point of the Serializable interface (in Spring AOP, only method execution is performed)
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 from execution (** (java. io. serializable): args matches only Serializable parameters passed in during dynamic running, while execution matches the Serializable interface when the type of the signature Declaration of the input parameter is implemented.
There is an arbitrary connection point in the target object of @ Transactional annotation (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 Declaration type of any target object has a connection point with @ Transactional annotation (in Spring AOP, only method execution is performed)
@ 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 executed has a @ Transactional annotation connection point (in Spring AOP, only method execution is performed)
@ 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 input parameter that accepts one parameter implements the @ Classified annotation connection point at runtime (in Spring AOP, only method execution is performed)
@ Args (com. xyz. security. Classified)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.