When spring AOP is configured, the meaning of the star inside expression

Source: Internet
Author: User
Tags aop modifiers regular expression
First, expression is defined as follows:
The full type of expression, as follows:
Execution (Modifiers-pattern ret-type-pattern declaring-type-pattern? Name-pattern (Param-pattern) Throws-pattern?)

Modifiers-pattern representative modifier (public/protect, etc.)

Ret-type-pattern represents the return type (Int/string/long, etc.)

Declaring-type-pattern represents the matching path (which is under what package)

Name-pattern represents matching method name Throws-pattern exception match type
You can not fill in the back with a question mark. is the meaning of 0 or 1 in a regular expression.

The return type mode determines that the return type of the method must match one connection point in turn. The most frequent return type pattern you will use is *, which represents the matching of any return type. A full-qualified type name will only match the method that returns the given type. The name pattern matches the method name. You can use the * wildcard character as all or part of the naming pattern. The parameter pattern is slightly more complex: () matches a method that does not accept any parameters, and (..) matches a method that accepts any number of parameters (0 or more). The pattern (*) matches a method that accepts a parameter of any type. Mode (*,string) matches a method that accepts two parameters, the first of which can be any type, and the second must be of type String. See the language Semantics section of the ASPECTJ Programming Guide.

Next, follow a configuration in my project to explain:

<aop:config>
		<aop:pointcut id= "mybatis_pc"
			expression= "Execution (* com.service.impl.*.*.* (..))" />
		<aop:advisor advice-ref= "Mybatis_advice" pointcut-ref= "mybatis_pc"/>
	</aop:config>



Excerpt from: http://blog.csdn.net/h396071018/article/details/6675129

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.