org.springframework.aop.framework.autoproxy
Class BeanNameAutoProxyCreator
java.lang.Object
org.springframework.aop.framework.ProxyConfig
org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator
- All Implemented Interfaces:
- BeanFactoryAware, BeanPostProcessor, Ordered
- public class BeanNameAutoProxyCreator
- extends AbstractAutoProxyCreator
Auto proxy creator that identifies beans to proxy via a list of names.
Checks for direct, "xxx*", and "*xxx" matches.
- Since:
- 10.10.2003
- Author:
- Juergen Hoeller
- See Also:
setBeanNames(java.lang.String[])
,
isMatch(java.lang.String, java.lang.String)
Method Summary |
protected java.lang.Object[] |
getInterceptorsAndAdvisorsForBean(java.lang.Object bean,
java.lang.String beanName)
Identify as bean to proxy if the bean name is in the configured list of names. |
protected boolean |
isMatch(java.lang.String beanName,
java.lang.String mappedName)
Return if the given bean name matches the mapped name. |
void |
setBeanNames(java.lang.String[] beanNames)
Set the names of the beans that should automatically get wrapped with proxies. |
Methods inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator |
getBeanFactory, getOrder, isInfrastructureClass, postProcessAfterInitialization, postProcessBeforeInitialization, setApplyCommonInterceptorsFirst, setBeanFactory, setCustomTargetSourceCreators, setInterceptorNames, setOrder, shouldSkip |
Methods inherited from class org.springframework.aop.framework.ProxyConfig |
copyFrom, getAopProxyFactory, getExposeProxy, getOptimize, getProxyTargetClass, isFrozen, setAopProxyFactory, setExposeProxy, setFrozen, setOptimize, setProxyTargetClass, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
BeanNameAutoProxyCreator
public BeanNameAutoProxyCreator()
setBeanNames
public void setBeanNames(java.lang.String[] beanNames)
- Set the names of the beans that should automatically get wrapped with proxies.
A name can specify a prefix to match by ending with "*", e.g. "myBean,tx*"
will match the bean named "myBean" and all beans whose name start with "tx".
getInterceptorsAndAdvisorsForBean
protected java.lang.Object[] getInterceptorsAndAdvisorsForBean(java.lang.Object bean,
java.lang.String beanName)
- Identify as bean to proxy if the bean name is in the configured list of names.
- Specified by:
getInterceptorsAndAdvisorsForBean
in class AbstractAutoProxyCreator
- Parameters:
bean
- the new bean instancebeanName
- the beanName of the bean
- Returns:
- an array of additional interceptors for the particular bean;
or an empty array if no additional interceptors but just the common ones;
or null if no proxy at all, not even with the common interceptors.
See constants DO_NOT_PROXY and PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS.
- See Also:
AbstractAutoProxyCreator.postProcessAfterInitialization(java.lang.Object, java.lang.String)
,
AbstractAutoProxyCreator.DO_NOT_PROXY
,
AbstractAutoProxyCreator.PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS
isMatch
protected boolean isMatch(java.lang.String beanName,
java.lang.String mappedName)
- Return if the given bean name matches the mapped name.
The default implementation checks for "xxx*" and "*xxx" matches.
Can be overridden in subclasses.
- Parameters:
beanName
- the bean name to checkmappedName
- the name in the configured list of names
- Returns:
- if the names match
Copyright (C) 2003-2004 The Spring Framework Project.