Class BeanNameAutoProxyCreator
java.lang.Object
org.springframework.aop.framework.ProxyConfig
org.springframework.aop.framework.ProxyProcessorSupport
org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator
- All Implemented Interfaces:
- Serializable,- AopInfrastructureBean,- Aware,- BeanClassLoaderAware,- BeanFactoryAware,- BeanPostProcessor,- InstantiationAwareBeanPostProcessor,- SmartInstantiationAwareBeanPostProcessor,- Ordered
Auto proxy creator that identifies beans to proxy via a list of names.
 Checks for direct, "xxx*", and "*xxx" matches.
 
For configuration details, see the javadoc of the parent class AbstractAutoProxyCreator. Typically, you will specify a list of interceptor names to apply to all identified beans, via the "interceptorNames" property.
- Since:
- 10.10.2003
- Author:
- Juergen Hoeller, Sam Brannen
- See Also:
- 
Field SummaryFields inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreatorDO_NOT_PROXY, logger, PROXY_WITHOUT_ADDITIONAL_INTERCEPTORSFields inherited from interface org.springframework.core.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected Object[]getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName, TargetSource targetSource) Identify as a bean to proxy if the bean name matches one of the names in the configured list of supported names.protected TargetSourcegetCustomTargetSource(Class<?> beanClass, String beanName) Delegate toAbstractAutoProxyCreator.getCustomTargetSource(Class, String)if the bean name matches one of the names in the configured list of supported names, returningnullotherwise.protected booleanDetermine if the given bean name matches the mapped name.voidsetBeanNames(String... beanNames) Set the names of the beans that should automatically get wrapped with proxies.Methods inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreatoradvisorsPreFiltered, buildAdvisors, createProxy, customizeProxyFactory, determineBeanType, determineCandidateConstructors, getBeanFactory, getCacheKey, getEarlyBeanReference, isFrozen, isInfrastructureClass, postProcessAfterInitialization, postProcessBeforeInstantiation, postProcessProperties, predictBeanType, setAdvisorAdapterRegistry, setApplyCommonInterceptorsFirst, setBeanFactory, setCustomTargetSourceCreators, setFrozen, setInterceptorNames, shouldProxyTargetClass, shouldSkip, wrapIfNecessaryMethods inherited from class org.springframework.aop.framework.ProxyProcessorSupportevaluateProxyInterfaces, getOrder, getProxyClassLoader, isConfigurationCallbackInterface, isInternalLanguageInterface, setBeanClassLoader, setOrder, setProxyClassLoaderMethods inherited from class org.springframework.aop.framework.ProxyConfigcopyFrom, isExposeProxy, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setOpaque, setOptimize, setProxyTargetClass, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.config.BeanPostProcessorpostProcessBeforeInitializationMethods inherited from interface org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorpostProcessAfterInstantiation
- 
Constructor Details- 
BeanNameAutoProxyCreatorpublic BeanNameAutoProxyCreator()
 
- 
- 
Method Details- 
setBeanNamesSet the names of the beans that should automatically get wrapped with proxies. A name can specify a prefix to match by ending with "*", for example, "myBean,tx*" will match the bean named "myBean" and all beans whose name start with "tx".NOTE: In case of a FactoryBean, only the objects created by the FactoryBean will get proxied. This default behavior applies as of Spring 2.0. If you intend to proxy a FactoryBean instance itself (a rare use case, but Spring 1.2's default behavior), specify the bean name of the FactoryBean including the factory-bean prefix "&": for example, "&myFactoryBean". - See Also:
 
- 
getCustomTargetSourceDelegate toAbstractAutoProxyCreator.getCustomTargetSource(Class, String)if the bean name matches one of the names in the configured list of supported names, returningnullotherwise.- Overrides:
- getCustomTargetSourcein class- AbstractAutoProxyCreator
- Parameters:
- beanClass- the class of the bean to create a TargetSource for
- beanName- the name of the bean
- Returns:
- a TargetSource for this bean
- Since:
- 5.3
- See Also:
 
- 
getAdvicesAndAdvisorsForBean@Nullable protected Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName, @Nullable TargetSource targetSource) Identify as a bean to proxy if the bean name matches one of the names in the configured list of supported names.- Specified by:
- getAdvicesAndAdvisorsForBeanin class- AbstractAutoProxyCreator
- Parameters:
- beanClass- the class of the bean to advise
- beanName- the name of the bean
- targetSource- the TargetSource returned by the- AbstractAutoProxyCreator.getCustomTargetSource(java.lang.Class<?>, java.lang.String)method: may be ignored. Will be- nullif no custom target source is in use.
- Returns:
- an array of additional interceptors for the particular bean;
 or an empty array if no additional interceptors but just the common ones;
 or nullif no proxy at all, not even with the common interceptors. See constants DO_NOT_PROXY and PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS.
- See Also:
 
- 
isMatchDetermine if the given bean name matches the mapped name.The default implementation checks for "xxx*", "*xxx" and "*xxx*" matches, as well as direct equality. Can be overridden in subclasses. - Parameters:
- beanName- the bean name to check
- mappedName- the name in the configured list of names
- Returns:
- if the names match
- See Also:
 
 
-