/**
* Face-cutting class: The method to insert the methods in the current class to the target object
*
* @ Author ASUS
*
*/
@ Aspect
// Indicates the partition class.
Public class proxyobj {
//// @ Before indicates the pre-notification. Call this method before executing the target method.
/// * COM. Lovo. Service. *. * (..) indicates the path of the target method.
/// The first * indicates that the return type of the method is of any type.
/// Com. Lovo. Service is the package name com. Lovo. Service.... It is the specified package and the specified sub-package.
/// *. * Indicates all the methods of all classes in the package. S *. * indicates all the methods of the classes starting with S in the package.
//// (..) The parameters in this method are arbitrary parameters.
/// @ Before ("execution (* COM. Lovo. Service .*.*(..))")
/// Public void ready (){
//// System. Out. println ("to start ordering... ");
////}
/// @ Afterreturning ("execution (* COM. Lovo. Service .*.*(..))")
/// Public void end (){
/// System. Out. println ("invoice .. ");
////}
//// Surround Annotation
// @ Around ("execution (* COM. Lovo. Service .*.*(..))")
// Public object around (proceedingjoinpoint point ){
// System. Out. println ("Get money ");
// Try {
/// Execute the target method. This method returns the value after the target method is executed.
// Object value = point. Proceed ();
// System. Out. println ("Tea top ");
// Return value;
//} Catch (throwable e ){
/// Todo auto-generated Catch Block
// E. printstacktrace ();
//}
// Return NULL;
//}
@ Afterthrowing (value = "execution (* COM. Lovo. Service. *. * (..)", throwing = "er ")
Public void throwsmethod (joinpoint point, exception ER ){
// Obtain the target object
Object OBJ = point. gettarget ();
// Obtain the target object type
String classname = obj. getclass (). getname ();
// Obtain the target method name.
String methodname = point. getsignature (). getname ();
System. Out. println ("execution" + classname + "" + methodname + "method, throw" + Er. getmessage ());
}
}
Configure dynamic proxy with Annotation