public abstract class AbstractAdvisingBeanPostProcessor extends ProxyConfig implements org.springframework.beans.factory.config.BeanPostProcessor, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.core.Ordered
BeanPostProcessor implementations that apply a
Spring AOP Advisor to specific beans.| Modifier and Type | Field and Description |
|---|---|
protected Advisor |
advisor |
protected boolean |
beforeExistingAdvisors |
| Constructor and Description |
|---|
AbstractAdvisingBeanPostProcessor() |
| Modifier and Type | Method and Description |
|---|---|
int |
getOrder() |
protected boolean |
isEligible(Object bean,
String beanName)
Check whether the given bean is eligible for advising with this
post-processor's
Advisor. |
Object |
postProcessAfterInitialization(Object bean,
String beanName) |
Object |
postProcessBeforeInitialization(Object bean,
String beanName) |
void |
setBeanClassLoader(ClassLoader beanClassLoader) |
void |
setBeforeExistingAdvisors(boolean beforeExistingAdvisors)
Set whether this post-processor's advisor is supposed to apply before
existing advisors when encountering a pre-advised object.
|
void |
setOrder(int order) |
copyFrom, isExposeProxy, isFrozen, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setFrozen, setOpaque, setOptimize, setProxyTargetClass, toStringprotected Advisor advisor
protected boolean beforeExistingAdvisors
public void setBeforeExistingAdvisors(boolean beforeExistingAdvisors)
Default is "false", applying the advisor after existing advisors, i.e. as close as possible to the target method. Switch this to "true" in order for this post-processor's advisor to wrap existing advisors as well.
Note: Check the concrete post-processor's javadoc whether it possibly changes this flag by default, depending on the nature of its advisor.
public void setBeanClassLoader(ClassLoader beanClassLoader)
setBeanClassLoader in interface org.springframework.beans.factory.BeanClassLoaderAwarepublic void setOrder(int order)
public int getOrder()
getOrder in interface org.springframework.core.Orderedpublic Object postProcessBeforeInitialization(Object bean, String beanName)
postProcessBeforeInitialization in interface org.springframework.beans.factory.config.BeanPostProcessorpublic Object postProcessAfterInitialization(Object bean, String beanName)
postProcessAfterInitialization in interface org.springframework.beans.factory.config.BeanPostProcessorprotected boolean isEligible(Object bean, String beanName)
Advisor.
Implements caching of canApply results per bean target class.
Can be overridden e.g. to specifically exclude certain beans by name.
bean - the bean instancebeanName - the name of the beanAopUtils.getTargetClass(Object),
AopUtils.canApply(Advisor, Class)