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.DO_NOT_PROXY, logger, PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
AspectJAwareAdvisorAutoProxyCreator() |
Modifier and Type | Method and Description |
---|---|
protected void |
extendAdvisors(List<Advisor> candidateAdvisors)
Add an
ExposeInvocationInterceptor to the beginning of the advice chain. |
protected boolean |
shouldSkip(Class<?> beanClass,
String beanName)
Subclasses should override this method to return
true if the
given bean should not be considered for auto-proxying by this post-processor. |
protected List<Advisor> |
sortAdvisors(List<Advisor> advisors)
Sort the supplied
Advisor instances according to AspectJ precedence. |
advisorsPreFiltered, findAdvisorsThatCanApply, findCandidateAdvisors, findEligibleAdvisors, getAdvicesAndAdvisorsForBean, initBeanFactory, isEligibleAdvisorBean, setBeanFactory
buildAdvisors, createProxy, customizeProxyFactory, determineCandidateConstructors, getBeanFactory, getCacheKey, getCustomTargetSource, getEarlyBeanReference, isFrozen, isInfrastructureClass, postProcessAfterInitialization, postProcessBeforeInstantiation, postProcessProperties, predictBeanType, setAdvisorAdapterRegistry, setApplyCommonInterceptorsFirst, setCustomTargetSourceCreators, setFrozen, setInterceptorNames, shouldProxyTargetClass, wrapIfNecessary
evaluateProxyInterfaces, getOrder, getProxyClassLoader, isConfigurationCallbackInterface, isInternalLanguageInterface, setBeanClassLoader, setOrder, setProxyClassLoader
copyFrom, isExposeProxy, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setOpaque, setOptimize, setProxyTargetClass, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
postProcessAfterInstantiation, postProcessPropertyValues
postProcessBeforeInitialization
protected List<Advisor> sortAdvisors(List<Advisor> advisors)
Advisor
instances 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:
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.
sortAdvisors
in class AbstractAdvisorAutoProxyCreator
advisors
- the source List of AdvisorsOrdered
,
Order
,
AnnotationAwareOrderComparator
protected void extendAdvisors(List<Advisor> candidateAdvisors)
ExposeInvocationInterceptor
to the beginning of the advice chain.
This additional advice is needed when using AspectJ pointcut expressions and when using AspectJ-style advice.
extendAdvisors
in class AbstractAdvisorAutoProxyCreator
candidateAdvisors
- the Advisors that have already been identified as
applying to a given beanprotected boolean shouldSkip(Class<?> beanClass, String beanName)
AbstractAutoProxyCreator
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, e.g. if it will lead to
a circular reference or if the existing target instance needs to be preserved.
This implementation returns false
unless the bean name indicates an
"original instance" according to AutowireCapableBeanFactory
conventions.
shouldSkip
in class AbstractAutoProxyCreator
beanClass
- the class of the beanbeanName
- the name of the beanAutowireCapableBeanFactory.ORIGINAL_INSTANCE_SUFFIX