publicList?getInterceptorsAndDynamicInterceptionAdvice(Advised?config,?Methodmethod,?Class?targetClass)?{??
//?This?is?somewhat?tricky...?we?have?to?process?introductions?first,??
//?but?we?need?to?preserve?order?in?the?ultimate?list.??
List?interceptorList?=?new?ArrayList(config.getAdvisors().length); ?
//查看是否包含IntroductionAdvisor??
boolean?hasIntroductions?=?hasMatchingIntroductions(config,targetClass);?
//這里實(shí)際上注冊一系列AdvisorAdapter,用于將Advisor轉(zhuǎn)化成MethodInterceptor??
AdvisorAdapterRegistry?registry?=?GlobalAdvisorAdapterRegistry.getInstance(); ?
Advisor[]?advisors?=?config.getAdvisors(); ?
? ? ? ? for?(int?i?=?0;?i?
Advisor?advisor?=?advisors[i];??
if?(advisor?instanceof?PointcutAdvisor)?{??
//?Add?it?conditionally.??
PointcutAdvisor?pointcutAdvisor=?(PointcutAdvisor)?advisor;??
if(config.isPreFiltered()?||pointcutAdvisor.getPointcut().getClassFilter().matches(targetClass))?{??
//TODO:?這個(gè)地方這兩個(gè)方法的位置可以互換下??
//將Advisor轉(zhuǎn)化成Interceptor??
MethodInterceptor[]interceptors?=?registry.getInterceptors(advisor);??
評論
查看更多