Spring AOP Execution Expression description

Source: Internet
Author: User

When using the spring framework to configure AOP, you need to define Pointcut "pointcuts" either through XML configuration files or annotations.

For example, defining pointcut expressions Execution (* com.sample.service.impl). *.*(..))

Execution () is the most commonly used pointcut function, and its syntax is as follows:

The entire expression can be divided into five parts:

1. Execution (): The body of an expression.

2, the first * Number: Indicates the return type, the * number denotes all types.

3. Package Name: Indicates the package name that needs to be intercepted, and the following two periods represent all the child packages of the current package and the current package,Com.sample.service.impl The package, and the descendants of all classes.

4, the second * Number: denotes the class name, the * number denotes all classes.

5, * (..): The last asterisk denotes the method name, the * number denotes all methods, the following parentheses indicate the parameters of the method, and two periods represent any parameters.


Spring AOP Execution Expression description

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.