The Spring Framework

org.springframework.aop.aspectj.autoproxy
Class AspectJInvocationContextExposingAdvisorAutoProxyCreator

java.lang.Object
  extended by org.springframework.aop.framework.ProxyConfig
      extended by org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
          extended by org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator
              extended by org.springframework.aop.aspectj.autoproxy.AspectJInvocationContextExposingAdvisorAutoProxyCreator
All Implemented Interfaces:
Serializable, BeanFactoryAware, BeanPostProcessor, InstantiationAwareBeanPostProcessor, Ordered
Direct Known Subclasses:
AnnotationAwareAspectJAutoProxyCreator

public class AspectJInvocationContextExposingAdvisorAutoProxyCreator
extends AbstractAdvisorAutoProxyCreator

An InvocationContextExposingAdvisorAutoProxyCreator that understands AspectJ's rules for advice precedence when multiple pieces of advice come from the same aspect.

Since:
2.0
Author:
Adrian Colyer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
DO_NOT_PROXY, PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS
 
Fields inherited from class org.springframework.aop.framework.ProxyConfig
exposeProxy, logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
AspectJInvocationContextExposingAdvisorAutoProxyCreator()
           
 
Method Summary
protected  void extendCandidateAdvisors(List candidateAdvisors)
          Adds an ExposeInvocationInterceptor to the beginning of the advice chain.
protected  List sortAdvisors(List advisors)
           Keep the special ExposeInvocationInterceptor at position 0 if present.
 
Methods inherited from class org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator
findCandidateAdvisors, findEligibleAdvisors, getAdvicesAndAdvisorsForBean, isEligibleAdvisorBean
 
Methods inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
createProxy, customizeProxyFactory, getBeanFactory, getCustomTargetSource, getOrder, isFrozen, isInfrastructureClass, isInfrastructureClass, postProcessAfterInitialization, postProcessAfterInstantiation, postProcessBeforeInitialization, postProcessBeforeInstantiation, postProcessPropertyValues, setAdvisorAdapterRegistry, setApplyCommonInterceptorsFirst, setBeanFactory, setCustomTargetSourceCreators, setFrozen, setInterceptorNames, setOrder, shouldSkip
 
Methods inherited from class org.springframework.aop.framework.ProxyConfig
copyFrom, getAopProxyFactory, isExposeProxy, isOpaque, isOptimize, isProxyTargetClass, setAopProxyFactory, setExposeProxy, setOpaque, setOptimize, setProxyTargetClass, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AspectJInvocationContextExposingAdvisorAutoProxyCreator

public AspectJInvocationContextExposingAdvisorAutoProxyCreator()
Method Detail

extendCandidateAdvisors

protected void extendCandidateAdvisors(List 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:
extendCandidateAdvisors in class AbstractAdvisorAutoProxyCreator
Parameters:
candidateAdvisors - Advisors that have already been identified as applying to a given bean

sortAdvisors

protected List sortAdvisors(List advisors)

Keep the special ExposeInvocationInterceptor at position 0 if present. Sort the rest by order. 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:

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
See Also:
Ordered, OrderComparator

The Spring Framework

Copyright © 2002-2006 The Spring Framework.