ASPECTJ uses the Org.aspectj.lang.JoinPoint interface to represent the target class connection point object, which, if it is a wrapping enhancement, uses Org.aspectj.lang.ProceedingJoinPoint to represent the connection point object, which is the sub-interface of the joinpoint. Any enhancement method can be accessed by declaring the first entry parameter as Joinpoint access to the connection point context. Let's take a look at the main methods of these two interfaces:
1) joinpoint
java.lang.object[] Getargs (): Gets the parameter list of the connection point method runtime;
signature getsignature (): Gets the method signature object of the connection point;
java.lang.object gettarget (): Gets the target object where the connection point resides;
java.lang.object getthis (): Gets the proxy object itself;
2) Proceedingjoinpoint
Proceedingjoinpoint inherits the Joinpoint Subinterface, which adds two methods for executing a connection point method:
java.lang.object proceed () throws Java.lang.Throwable: Performs the method at the connection point of the target object by reflection;
java.lang.object Proceed (java.lang.object[] args) throws Java.lang.Throwable: Performs the method at the target object connection point by reflection, but replaces the original entry with the new entry parameter.
Note: proceedingjoinpoint: Use this class to take processing logs and only handle surround notifications
<!--open an AOP interception function, Proxy-target-class: is used to control the injection of the implementation class or interface, the default is False indicates that only the interface can be injected, true: it is possible to use the class to inject-<AOP: Aspectj-autoproxy proxy-target-class= "false"/> <aop:config> <!--Declare a slice---<aop:aspect id= "Testexcuteaspect" ref= "Testexcute" > <!--declare an outfit, when does the log processing--<!--declares a pointcut, expression: the first * means: wildcard, which indicates the return Back to any type, the second * means: wildcards, which represent any class under this package, the third * means: wildcards, which means that methods under this class can have 0 or more Parameter (..) : Represents all sub-packages under this package--<aop:pointcut expression= "Execution (* com.ckpt.logPackage .*.*(..))" Id= "Logtest"/> <aop:around method= "GetLog" pointcut-ref= "Logtest"/> </aop:aspect> </aop:config>
; <bean id= "Testexcute" class= "Com.ckpt.logPackage.TestExcute" scope= "prototype" ></bean> <bean id= "
Test "class=" Com.ckpt.Action.Test "scope=" prototype "> <property name=" test2 "ref=" Test2 "></property> </bean> <beanId= "Test2" class= "Com.ckpt.logPackage.Test2" scope= "prototype" ></bean>