Top Description Fields Constructors Methods
org.springframework.aop.framework.autoproxy

public Class DefaultAdvisorAutoProxyCreator

extends AbstractAdvisorAutoProxyCreator
implements BeanNameAware
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.Aware
Annotations
@SuppressWarnings:serial
Imports
org.springframework.beans.factory.BeanNameAware, org.springframework.lang.Nullable

BeanPostProcessor implementation that creates AOP proxies based on all candidate Advisors 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.

Authors
Rod Johnson, Rob Harrop

Field Summary

Modifier and TypeField and Description
private String
public static final String
SEPARATOR

Separator between prefix and remainder of bean name.

private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public 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
the name of the Advisor bean
beanName
)

Overrides org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.isEligibleAdvisorBean.

Consider Advisor beans with the specified prefix as eligible, if activated.
public boolean
isUsePrefix()

Return whether to only include advisors with a certain prefix in the bean name.

public void
setAdvisorBeanNamePrefix(String
the exclusion prefix
advisorBeanNamePrefix
)

Set the prefix for bean names that will cause them to be included for auto-proxying by this object.

public void
setBeanName(String
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.
name
)

Implements org.springframework.beans.factory.BeanNameAware.setBeanName.

Set the name of the bean in the bean factory that created this bean.
public void
setUsePrefix(boolean usePrefix)

Set whether to only include advisors with a certain prefix in the bean name.

Inherited from org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator:
advisorsPreFilteredextendAdvisorsfindAdvisorsThatCanApplyfindCandidateAdvisorsfindEligibleAdvisorsgetAdvicesAndAdvisorsForBeaninitBeanFactorysetBeanFactorysortAdvisors

Field Detail

advisorBeanNamePrefixback to summary
private String advisorBeanNamePrefix
Annotations
@Nullable
SEPARATORback to summary
public static final String SEPARATOR

Separator between prefix and remainder of bean name.

usePrefixback to summary
private boolean usePrefix

Constructor Detail

DefaultAdvisorAutoProxyCreatorback to summary
public DefaultAdvisorAutoProxyCreator()

Method Detail

getAdvisorBeanNamePrefixback to summary
public String getAdvisorBeanNamePrefix()

Return the prefix for bean names that will cause them to be included for auto-proxying by this object.

Annotations
@Nullable
isEligibleAdvisorBeanback to summary
protected boolean isEligibleAdvisorBean(String beanName)

Overrides org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.isEligibleAdvisorBean.

Consider Advisor beans with the specified prefix as eligible, if activated.

Parameters
beanName:String

Doc from org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.isEligibleAdvisorBean.

the name of the Advisor bean

Returns:boolean

Doc from org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.isEligibleAdvisorBean.

whether the bean is eligible

Annotations
@Override
See Also
setUsePrefix, setAdvisorBeanNamePrefix
isUsePrefixback to summary
public boolean isUsePrefix()

Return whether to only include advisors with a certain prefix in the bean name.

setAdvisorBeanNamePrefixback to summary
public void setAdvisorBeanNamePrefix(String advisorBeanNamePrefix)

Set the prefix for bean names that will cause them to be included for auto-proxying by this object. This prefix should be set to avoid circular references. Default value is the bean name of this object + a dot.

Parameters
advisorBeanNamePrefix:String

the exclusion prefix

setBeanNameback to summary
public void setBeanName(String name)

Implements org.springframework.beans.factory.BeanNameAware.setBeanName.

Doc from org.springframework.beans.factory.BeanNameAware.setBeanName.

Set the name of the bean in the bean factory that created this bean.

Invoked after population of normal bean properties but before an init callback such as InitializingBean#afterPropertiesSet() or a custom init-method.

Parameters
name:String

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.

Annotations
@Override
setUsePrefixback to summary
public void setUsePrefix(boolean usePrefix)

Set whether to only include advisors with a certain prefix in the bean name.

Default is false, including all beans of type Advisor.

See Also
setAdvisorBeanNamePrefix