SpringAop configuration instructions

  <!-- The methods included in the datasourceone database transaction management pointcut   
       : all methods in all classes whose names end with 'Service' under the service package (or subpackage).          Methods not included: getResCategory(..) method, getEditorResList(..) method, updateResbackrmd(..) method  
       of PublishService class under xyservice package     -->    <aop:pointcut id="txPointcut-datasourceone"        expression="execution( * xyservice..*Service.*(..))          and !execution(* xyservice.PublishService.getResCategory(..))          and !execution(* xyservice.PublishService.getEditorResList(..))          and !execution(* xyservice. PublishService.updateResbackrmd(..))"/>  1. Pointcut can be defined either on an interface (meaning that the class method implementing the interface will be intercepted), or on a class (    if there is , cglib needs to be used). When defining pointcut on an interface, you don't need to care about the specific location of the interface implementation class, you only need to define the intercepted interface and method.











   legal position.

2. Common cases:
xyservice..*Service.*(..)
xyservice - package "xyservice"
xyservice.. - package "xyservice" and its sub-packages For example: "xyservice.abc", "xyservice.def" , "xyservice.ghi", "xyservice.jkl". . .
*Service —— Define an interface (or a class that does not implement an interface, you need to use a cglib proxy) expression; all classes or interfaces ending with Service, note that not all package names ending with Service.
*(..) —— Define method name, method parameter expression; any method name, any method parameter.

com.xyz.service.*.*(..)
com.xyz.service - package "com.xyz.service"
*.*(..) - any interface (or class that does not implement an interface, requires cglib Proxy), any method, any parameter The execution of any method defined under
the service package.

com.xyz.service..*.*(..)
com.xyz.service -- package "com.xyz.service"
com.xyz.service.. -- package "com.xyz.service" and its subpackages
*.*(..) - any interface (or a class that does not implement an interface, you need to use a cglib proxy), any method, any parameter

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326664516&siteId=291194637