Class AspectJAwareAdvisorAutoProxyCreator
- All Implemented Interfaces:
- Serializable, AopInfrastructureBean, Aware, BeanClassLoaderAware, BeanFactoryAware, BeanPostProcessor, InstantiationAwareBeanPostProcessor, SmartInstantiationAwareBeanPostProcessor, DisposableBean, SmartInitializingSingleton, Ordered
- Direct Known Subclasses:
- AnnotationAwareAspectJAutoProxyCreator
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:
- 
Field SummaryFields inherited from class AbstractAutoProxyCreatorDO_NOT_PROXY, logger, PROXY_WITHOUT_ADDITIONAL_INTERCEPTORSFields inherited from interface OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidInvoked right at the end of the singleton pre-instantiation phase, with a guarantee that all regular singleton beans have been created already.voiddestroy()Invoked by the containingBeanFactoryon destruction of a bean.protected voidextendAdvisors(List<Advisor> candidateAdvisors) Add anExposeInvocationInterceptorto the beginning of the advice chain.protected booleanshouldSkip(Class<?> beanClass, String beanName) Subclasses should override this method to returntrueif the given bean should not be considered for auto-proxying by this post-processor.sortAdvisors(List<Advisor> advisors) Sort the suppliedAdvisorinstances according to AspectJ precedence.Methods inherited from class AbstractAdvisorAutoProxyCreatoradvisorsPreFiltered, findAdvisorsThatCanApply, findCandidateAdvisors, findEligibleAdvisors, getAdvicesAndAdvisorsForBean, initBeanFactory, isEligibleAdvisorBean, setBeanFactoryMethods inherited from class AbstractAutoProxyCreatorbuildAdvisors, createProxy, customizeProxyFactory, determineBeanType, determineCandidateConstructors, getBeanFactory, getCacheKey, getCustomTargetSource, getEarlyBeanReference, isInfrastructureClass, postProcessAfterInitialization, postProcessBeforeInstantiation, postProcessProperties, predictBeanType, setAdvisorAdapterRegistry, setApplyCommonInterceptorsFirst, setCustomTargetSourceCreators, setInterceptorNames, shouldProxyTargetClass, wrapIfNecessaryMethods inherited from class ProxyProcessorSupportevaluateProxyInterfaces, getOrder, getProxyClassLoader, isConfigurationCallbackInterface, isInternalLanguageInterface, setBeanClassLoader, setOrder, setProxyClassLoaderMethods inherited from class ProxyConfigcopyDefault, copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClass, toStringMethods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface BeanPostProcessorpostProcessBeforeInitializationMethods inherited from interface InstantiationAwareBeanPostProcessorpostProcessAfterInstantiation
- 
Constructor Details- 
AspectJAwareAdvisorAutoProxyCreatorpublic AspectJAwareAdvisorAutoProxyCreator()
 
- 
- 
Method Details- 
sortAdvisorsSort the suppliedAdvisorinstances according to AspectJ precedence.If two pieces of advice 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 (i.e., runs last).
- Otherwise the advice declared first gets highest precedence (i.e., runs first).
 Important: Advisors are sorted in precedence order, from the highest precedence to the 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:
- sortAdvisorsin class- AbstractAdvisorAutoProxyCreator
- Parameters:
- advisors- the source List of Advisors
- Returns:
- the sorted List of Advisors
- See Also:
 
- 
extendAdvisorsAdd anExposeInvocationInterceptorto the beginning of the advice chain.This additional advice is needed when using AspectJ pointcut expressions and when using AspectJ-style advice. - Overrides:
- extendAdvisorsin class- AbstractAdvisorAutoProxyCreator
- Parameters:
- candidateAdvisors- the Advisors that have already been identified as applying to a given bean
 
- 
shouldSkipDescription copied from class:AbstractAutoProxyCreatorSubclasses should override this method to returntrueif the given bean should not be considered for auto-proxying by this post-processor.Sometimes we need to be able to avoid this happening, for example, if it will lead to a circular reference or if the existing target instance needs to be preserved. This implementation returns falseunless the bean name indicates an "original instance" according toAutowireCapableBeanFactoryconventions.- Overrides:
- shouldSkipin class- AbstractAutoProxyCreator
- Parameters:
- beanClass- the class of the bean
- beanName- the name of the bean
- Returns:
- whether to skip the given bean
- See Also:
 
- 
afterSingletonsInstantiatedpublic void afterSingletonsInstantiated()Description copied from interface:SmartInitializingSingletonInvoked right at the end of the singleton pre-instantiation phase, with a guarantee that all regular singleton beans have been created already.ListableBeanFactory.getBeansOfType(Class)calls within this method won't trigger accidental side effects during bootstrap.NOTE: This callback won't be triggered for singleton beans lazily initialized on demand after BeanFactorybootstrap, and not for any other bean scope either. Carefully use it for beans with the intended bootstrap semantics only.- Specified by:
- afterSingletonsInstantiatedin interface- SmartInitializingSingleton
 
- 
destroypublic void destroy()Description copied from interface:DisposableBeanInvoked by the containingBeanFactoryon destruction of a bean.- Specified by:
- destroyin interface- DisposableBean
 
 
-