1 16 17 package org.springframework.aop.aspectj; 18 19 import java.util.Iterator ; 20 import java.util.List ; 21 22 import org.springframework.aop.Advisor; 23 import org.springframework.aop.interceptor.ExposeInvocationInterceptor; 24 25 31 public abstract class AspectJProxyUtils { 32 33 41 public static boolean makeAdvisorChainAspectJCapableIfNecessary(List advisors) { 42 if (!advisors.isEmpty()) { 44 boolean foundAspectJAdvice = false; 45 for (Iterator it = advisors.iterator(); it.hasNext() && !foundAspectJAdvice; ) { 46 Advisor advisor = (Advisor) it.next(); 47 if (advisor instanceof InstantiationModelAwarePointcutAdvisor || 50 advisor.getAdvice() instanceof AbstractAspectJAdvice) { 51 foundAspectJAdvice = true; 52 } 53 } 54 if (foundAspectJAdvice && !advisors.contains(ExposeInvocationInterceptor.ADVISOR)) { 55 advisors.add(0, ExposeInvocationInterceptor.ADVISOR); 56 return true; 57 } 58 } 59 return false; 60 } 61 62 } 63 | Popular Tags |