public class BeanNameAutoProxyCreator extends AbstractAutoProxyCreator
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.
setBeanNames(java.lang.String...),
isMatch(java.lang.String, java.lang.String),
AbstractAutoProxyCreator.setInterceptorNames(java.lang.String...),
AbstractAutoProxyCreator,
Serialized FormDO_NOT_PROXY, logger, PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS| Constructor and Description |
|---|
BeanNameAutoProxyCreator() |
| Modifier and Type | Method and Description |
|---|---|
protected 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 TargetSource |
getCustomTargetSource(Class<?> beanClass,
String beanName)
Delegate to
AbstractAutoProxyCreator.getCustomTargetSource(Class, String)
if the bean name matches one of the names in the configured list of supported
names, returning null otherwise. |
protected boolean |
isMatch(String beanName,
String mappedName)
Determine if the given bean name matches the mapped name.
|
void |
setBeanNames(String... beanNames)
Set the names of the beans that should automatically get wrapped with proxies.
|
advisorsPreFiltered, buildAdvisors, createProxy, customizeProxyFactory, determineCandidateConstructors, getBeanFactory, getCacheKey, getEarlyBeanReference, isFrozen, isInfrastructureClass, postProcessAfterInitialization, postProcessBeforeInstantiation, postProcessProperties, predictBeanType, setAdvisorAdapterRegistry, setApplyCommonInterceptorsFirst, setBeanFactory, setCustomTargetSourceCreators, setFrozen, setInterceptorNames, shouldProxyTargetClass, shouldSkip, wrapIfNecessaryevaluateProxyInterfaces, getOrder, getProxyClassLoader, isConfigurationCallbackInterface, isInternalLanguageInterface, setBeanClassLoader, setOrder, setProxyClassLoadercopyFrom, isExposeProxy, isOpaque, isOptimize, isProxyTargetClass, setExposeProxy, setOpaque, setOptimize, setProxyTargetClass, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic void setBeanNames(String... beanNames)
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 "&": e.g. "&myFactoryBean".
FactoryBean,
BeanFactory.FACTORY_BEAN_PREFIXprotected TargetSource getCustomTargetSource(Class<?> beanClass, String beanName)
AbstractAutoProxyCreator.getCustomTargetSource(Class, String)
if the bean name matches one of the names in the configured list of supported
names, returning null otherwise.getCustomTargetSource in class AbstractAutoProxyCreatorbeanClass - the class of the bean to create a TargetSource forbeanName - the name of the beansetBeanNames(String...)@Nullable protected Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName, @Nullable TargetSource targetSource)
getAdvicesAndAdvisorsForBean in class AbstractAutoProxyCreatorbeanClass - the class of the bean to advisebeanName - the name of the beantargetSource - the TargetSource returned by the
AbstractAutoProxyCreator.getCustomTargetSource(java.lang.Class<?>, java.lang.String) method: may be ignored.
Will be null if no custom target source is in use.null if no proxy at all, not even with the common interceptors.
See constants DO_NOT_PROXY and PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS.setBeanNames(String...)protected boolean isMatch(String beanName, String mappedName)
The default implementation checks for "xxx*", "*xxx" and "*xxx*" matches, as well as direct equality. Can be overridden in subclasses.
beanName - the bean name to checkmappedName - the name in the configured list of namesPatternMatchUtils.simpleMatch(String, String)