Springaop Study Notes
1. joinpoint in Spring AOP only supports joinpoint for method execution
2. pointcut in Spring AOP
Org. springframework. AOP. pointcut is the top-level abstraction of pointcut.
Package org. springframework. AOP; public interface pointcut {classfilter getclassfilter (); methodmatcher getmethodmatcher (); pointcut true = truepointcut. instance ;}
Getclassfilter and methodmatcher are used to match the woven operation object and corresponding methods respectively.
Package org. springframework. AOP; public interface classfilter {// If clazz is consistent with the phenomena we are concerned about, true is returned, and false Boolean matches (class <?> Clazz); // static parameter if the type does not matter for the pointcut to be captured, we can pass this parameter to pointcut classfilter true = trueclassfilter. instance ;}
Package org. springframework. AOP; public interface methodmatcher {Boolean matches (method, class <?> Targetclass);/*** whether it is sensitive to parameter values * if it is false, it indicates that the parameter value does not need to be determined during matching (the parameter value is not sensitive), which is called staticmethodmatcher, only * matches (method, class <?> Targetclass); executed, the execution results can be cached to improve efficiency. * If it is true, it indicates that the parameter value needs to be determined during matching (the parameter value is sensitive), which is called dynamicmethodmatcher. Then, * matches (method, class <?> Targetclass); if true is returned, execute * Boolean matches (method, class <?> Targetclass, object [] ARGs); further judgment has been made **/Boolean isruntime (); Boolean matches (method, class <?> Targetclass, object [] ARGs); methodmatcher true = truemethodmatcher. instance ;}