Class DefaultAdvisorAutoProxyCreator
java.lang.Object
org.springframework.aop.framework.ProxyConfig
org.springframework.aop.framework.ProxyProcessorSupport
org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator
org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator
- All Implemented Interfaces:
Serializable,AopInfrastructureBean,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanClassLoaderAware,org.springframework.beans.factory.BeanFactoryAware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.config.BeanPostProcessor,org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor,org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor,org.springframework.core.Ordered
public class DefaultAdvisorAutoProxyCreator
extends AbstractAdvisorAutoProxyCreator
implements org.springframework.beans.factory.BeanNameAware
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.
- Author:
- Rod Johnson, Rob Harrop
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSeparator between prefix and remainder of bean name.Fields inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
DO_NOT_PROXY, logger, PROXY_WITHOUT_ADDITIONAL_INTERCEPTORSFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the prefix for bean names that will cause them to be included for auto-proxying by this object.protected booleanisEligibleAdvisorBean(String beanName) ConsiderAdvisorbeans with the specified prefix as eligible, if activated.booleanReturn whether to only include advisors with a certain prefix in the bean name.voidsetAdvisorBeanNamePrefix(String advisorBeanNamePrefix) Set the prefix for bean names that will cause them to be included for auto-proxying by this object.voidsetBeanName(String name) voidsetUsePrefix(boolean usePrefix) Set whether to only include advisors with a certain prefix in the bean name.Methods inherited from class org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator
advisorsPreFiltered, extendAdvisors, findAdvisorsThatCanApply, findCandidateAdvisors, findEligibleAdvisors, getAdvicesAndAdvisorsForBean, initBeanFactory, setBeanFactory, sortAdvisorsMethods inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
buildAdvisors, createProxy, customizeProxyFactory, determineBeanType, determineCandidateConstructors, getBeanFactory, getCacheKey, getCustomTargetSource, getEarlyBeanReference, isFrozen, isInfrastructureClass, postProcessAfterInitialization, postProcessBeforeInstantiation, postProcessProperties, predictBeanType, setAdvisorAdapterRegistry, setApplyCommonInterceptorsFirst, setCustomTargetSourceCreators, setFrozen, setInterceptorNames, shouldProxyTargetClass, shouldSkip, wrapIfNecessaryMethods inherited from class org.springframework.aop.framework.ProxyProcessorSupport
evaluateProxyInterfaces, getOrder, getProxyClassLoader, isConfigurationCallbackInterface, isInternalLanguageInterface, setBeanClassLoader, setOrder, setProxyClassLoaderMethods inherited from class org.springframework.aop.framework.ProxyConfig
copyFrom, isExposeProxy, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setOpaque, setOptimize, setProxyTargetClass, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.config.BeanPostProcessor
postProcessBeforeInitializationMethods inherited from interface org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessor
postProcessAfterInstantiation
-
Field Details
-
SEPARATOR
Separator between prefix and remainder of bean name.- See Also:
-
-
Constructor Details
-
DefaultAdvisorAutoProxyCreator
public DefaultAdvisorAutoProxyCreator()
-
-
Method Details
-
setUsePrefix
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 typeAdvisor. -
isUsePrefix
public boolean isUsePrefix()Return whether to only include advisors with a certain prefix in the bean name. -
setAdvisorBeanNamePrefix
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- the exclusion prefix
-
getAdvisorBeanNamePrefix
Return the prefix for bean names that will cause them to be included for auto-proxying by this object. -
setBeanName
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
isEligibleAdvisorBean
ConsiderAdvisorbeans with the specified prefix as eligible, if activated.- Overrides:
isEligibleAdvisorBeanin classAbstractAdvisorAutoProxyCreator- Parameters:
beanName- the name of the Advisor bean- Returns:
- whether the bean is eligible
- See Also:
-