// DefaultAdvisorChainFactory.javapublicList<Object>getInterceptorsAndDynamicInterceptionAdvice(Advised config,Method method,@NullableClass<?> targetClass){// This is somewhat tricky... We have to process introductions first,// but we need to preserve order in the ultimate list.AdvisorAdapterRegistry registry =GlobalAdvisorAdapterRegistry.getInstance();Advisor[] advisors = config.getAdvisors();List<Object> interceptorList =newArrayList<>(advisors.length);Class<?> actualClass =(targetClass !=null? targetClass : method.getDeclaringClass());Boolean hasIntroductions =null;for(Advisor advisor : advisors){if(advisor instanceofPointcutAdvisor){// Add it conditionally.PointcutAdvisor pointcutAdvisor =(PointcutAdvisor) advisor;if(config.isPreFiltered()|| pointcutAdvisor.getPointcut().getClassFilter().matches(actualClass)){MethodMatcher mm = pointcutAdvisor.getPointcut().getMethodMatcher();boolean match;if(mm instanceofIntroductionAwareMethodMatcher){if(hasIntroductions ==null){
hasIntroductions =hasMatchingIntroductions(advisors, actualClass);}
match =((IntroductionAwareMethodMatcher) mm).matches(method, actualClass, hasIntroductions);}else{
match = mm.matches(method, actualClass);}if(match){MethodInterceptor[] interceptors = registry.getInterceptors(advisor);if(mm.isRuntime()){// Creating a new object instance in the getInterceptors() method// isn't a problem as we normally cache created chains.for(MethodInterceptor interceptor : interceptors){
interceptorList.add(newInterceptorAndDynamicMethodMatcher(interceptor, mm));}}else{
interceptorList.addAll(Arrays.asList(interceptors));}}}}elseif(advisor instanceofIntroductionAdvisor){IntroductionAdvisor ia =(IntroductionAdvisor) advisor;if(config.isPreFiltered()|| ia.getClassFilter().matches(actualClass)){Interceptor[] interceptors = registry.getInterceptors(advisor);
interceptorList.addAll(Arrays.asList(interceptors));}}else{Interceptor[] interceptors = registry.getInterceptors(advisor);
interceptorList.addAll(Arrays.asList(interceptors));}}return interceptorList;}