spring study day 7 (PCD cutting point and expression)

1.PCD(PointCutDesigner)

The spring aop aop proxy for the only method, but aop apectj Union more powerful than, the section can also be programmed for fields, etc.

 1.1: execution, the most used, to match the connection point method

 1.2: within: translation is "in-house", a proxy for all methods in a / some class

 1.3: this: after determining the dynamic proxy is a type

 1.4: target: specify the type of object being proxied

 1.5: args: parameter types specified method, for example, args (Integer, String)

 1.6: @target: specific comment on the modified target type

 1.7: @args: indicates a specific comment on the modified parameter

 1.8: @within: indicates a specific comment on the modified class

 1.9: @annotation: annotation specific modification method of the connection point

 1.10: bean: spring aop provided, assigned a specific bean names

2. indicator logical operators: and (instead of &&), or (in place of ||), not (instead of!)

3.execution: written in the format:

execution(modifiers-pattern? ret-type-pattern declaring-type-pattern?name-pattern(param-pattern)throws-pattern?)

Which ret-type-pattern, name-pattern (param-pattern) it is necessary to write three

? Indicates optional

modifiers-pattern: pattern modifiers, optional

ret-type-pattern: the return type mode, will write

declaring-type-pattern: declare type mode, that is, the package name and class name denoted between what under what optional. ""

name-pattern: method name pattern, will write

param-pattern: Parameter mode, method parameters, will write

throws-pattern: abnormal pattern, alternatively, the format: throws Exception

Wildcards: *: represents any names ..: any segment of any character, such as com.service.impl package can be directly written com * * com .. or can.

Some common examples:

 1: execution (public * * (..)) all public methods

 2: execution (* get * (..)) any method to get the beginning of the

 3: execution (* com.service.impl.DeptService +) indicates all the methods and implements all the interfaces of the interface methods are aop Agent

 4: (* com .. * (..)) and all the packages in the com method in execution sub-packet com

 

Guess you like

Origin www.cnblogs.com/woyujiezhen/p/11751520.html