org.springframework.aop.aspectj.autoproxy
Class AspectJAwareAdvisorAutoProxyCreator
java.lang.Object
org.springframework.aop.framework.ProxyConfig
org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator
org.springframework.aop.aspectj.autoproxy.AspectJAwareAdvisorAutoProxyCreator
- All Implemented Interfaces:
- Serializable, AopInfrastructureBean, Aware, BeanClassLoaderAware, BeanFactoryAware, BeanPostProcessor, InstantiationAwareBeanPostProcessor, SmartInstantiationAwareBeanPostProcessor, Ordered
- Direct Known Subclasses:
- AnnotationAwareAspectJAutoProxyCreator
public class AspectJAwareAdvisorAutoProxyCreator
- extends AbstractAdvisorAutoProxyCreator
AbstractAdvisorAutoProxyCreator
subclass that exposes AspectJ's invocation context and understands AspectJ's rules
for advice precedence when multiple pieces of advice come from the same aspect.
- Since:
- 2.0
- Author:
- Adrian Colyer, Juergen Hoeller, Ramnivas Laddad
- See Also:
- Serialized Form
Methods inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator |
buildAdvisors, createProxy, customizeProxyFactory, determineCandidateConstructors, getBeanFactory, getCacheKey, getCustomTargetSource, getEarlyBeanReference, getOrder, isFrozen, isInfrastructureClass, postProcessAfterInitialization, postProcessAfterInstantiation, postProcessBeforeInitialization, postProcessBeforeInstantiation, postProcessPropertyValues, predictBeanType, setAdvisorAdapterRegistry, setApplyCommonInterceptorsFirst, setBeanClassLoader, setCustomTargetSourceCreators, setFrozen, setInterceptorNames, setOrder, setProxyClassLoader, shouldProxyTargetClass, wrapIfNecessary |
AspectJAwareAdvisorAutoProxyCreator
public AspectJAwareAdvisorAutoProxyCreator()
sortAdvisors
protected List<Advisor> sortAdvisors(List<Advisor> advisors)
- Sort the rest by AspectJ precedence. If two pieces of advice have
come from the same aspect they will have the same order.
Advice from the same aspect is then further ordered according to the
following rules:
- if either of the pair is after advice, then the advice declared
last gets highest precedence (runs last)
- otherwise the advice declared first gets highest precedence (runs first)
Important: Advisors are sorted in precedence order, from highest
precedence to lowest. "On the way in" to a join point, the highest precedence
advisor should run first. "On the way out" of a join point, the highest precedence
advisor should run last.
- Overrides:
sortAdvisors
in class AbstractAdvisorAutoProxyCreator
- Parameters:
advisors
- the source List of Advisors
- Returns:
- the sorted List of Advisors
- See Also:
Ordered
,
OrderComparator
extendAdvisors
protected void extendAdvisors(List<Advisor> candidateAdvisors)
- Adds an
ExposeInvocationInterceptor
to the beginning of the advice chain.
These additional advices are needed when using AspectJ expression pointcuts
and when using AspectJ-style advice.
- Overrides:
extendAdvisors
in class AbstractAdvisorAutoProxyCreator
- Parameters:
candidateAdvisors
- Advisors that have already been identified as
applying to a given bean
shouldSkip
protected boolean shouldSkip(Class beanClass,
String beanName)
- Description copied from class:
AbstractAutoProxyCreator
- Subclasses should override this method to return
true
if the
given bean should not be considered for auto-proxying by this post-processor.
Sometimes we need to be able to avoid this happening if it will lead to
a circular reference. This implementation returns false
.
- Overrides:
shouldSkip
in class AbstractAutoProxyCreator
- Parameters:
beanClass
- the class of the beanbeanName
- the name of the bean
- Returns:
- whether to skip the given bean