public class DefaultAdvisorAutoProxyCreator extends AbstractAdvisorAutoProxyCreator implements BeanNameAware
BeanPostProcessor
implementation that creates AOP proxies based on all
candidate Advisor
s in the current BeanFactory
. This class is
completely generic; it contains no special code to handle any particular aspects,
such as pooling aspects.
It's possible to filter out advisors - for example, to use multiple post processors
of this type in the same factory - by setting the usePrefix
property to true,
in which case only advisors beginning with the DefaultAdvisorAutoProxyCreator's bean
name followed by a dot (like "aapc.") will be used. This default prefix can be changed
from the bean name by setting the advisorBeanNamePrefix
property.
The separator (.) will also be used in this case.
Modifier and Type | Field and Description |
---|---|
static String |
SEPARATOR
Separator between prefix and remainder of bean name.
|
DO_NOT_PROXY, logger, PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
DefaultAdvisorAutoProxyCreator() |
Modifier and Type | Method and Description |
---|---|
String |
getAdvisorBeanNamePrefix()
Return the prefix for bean names that will cause them to be included
for auto-proxying by this object.
|
protected boolean |
isEligibleAdvisorBean(String beanName)
Consider
Advisor beans with the specified prefix as eligible, if activated. |
boolean |
isUsePrefix()
Return whether to only include advisors with a certain prefix in the bean name.
|
void |
setAdvisorBeanNamePrefix(String advisorBeanNamePrefix)
Set the prefix for bean names that will cause them to be included for
auto-proxying by this object.
|
void |
setBeanName(String name)
Set the name of the bean in the bean factory that created this bean.
|
void |
setUsePrefix(boolean usePrefix)
Set whether to only include advisors with a certain prefix in the bean name.
|
advisorsPreFiltered, extendAdvisors, findAdvisorsThatCanApply, findCandidateAdvisors, findEligibleAdvisors, getAdvicesAndAdvisorsForBean, initBeanFactory, setBeanFactory, sortAdvisors
buildAdvisors, createProxy, customizeProxyFactory, determineCandidateConstructors, getBeanFactory, getCacheKey, getCustomTargetSource, getEarlyBeanReference, isFrozen, isInfrastructureClass, postProcessAfterInitialization, postProcessBeforeInstantiation, postProcessProperties, predictBeanType, setAdvisorAdapterRegistry, setApplyCommonInterceptorsFirst, setCustomTargetSourceCreators, setFrozen, setInterceptorNames, shouldProxyTargetClass, shouldSkip, 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
public static final String SEPARATOR
public void setUsePrefix(boolean usePrefix)
Default is false
, including all beans of type Advisor
.
public boolean isUsePrefix()
public void setAdvisorBeanNamePrefix(@Nullable String advisorBeanNamePrefix)
advisorBeanNamePrefix
- the exclusion prefix@Nullable public String getAdvisorBeanNamePrefix()
public void setBeanName(String name)
BeanNameAware
Invoked after population of normal bean properties but before an
init callback such as InitializingBean.afterPropertiesSet()
or a custom init-method.
setBeanName
in interface BeanNameAware
name
- the name of the bean in the factory.
Note that this name is the actual bean name used in the factory, which may
differ from the originally specified name: in particular for inner bean
names, the actual bean name might have been made unique through appending
"#..." suffixes. Use the BeanFactoryUtils.originalBeanName(String)
method to extract the original bean name (without suffix), if desired.protected boolean isEligibleAdvisorBean(String beanName)
Advisor
beans with the specified prefix as eligible, if activated.isEligibleAdvisorBean
in class AbstractAdvisorAutoProxyCreator
beanName
- the name of the Advisor beansetUsePrefix(boolean)
,
setAdvisorBeanNamePrefix(java.lang.String)