站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

BeanNameAutoProxyCreator (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.aop.framework.autoproxy
Class BeanNameAutoProxyCreator

java.lang.Object
  extended by org.springframework.aop.framework.ProxyConfig
      extended by org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
          extended by org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator
All Implemented Interfaces:
Serializable, BeanFactoryAware, BeanPostProcessor, InstantiationAwareBeanPostProcessor, 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.

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
See Also:
setBeanNames(java.lang.String[]), isMatch(java.lang.String, java.lang.String), AbstractAutoProxyCreator.setInterceptorNames(java.lang.String[]), AbstractAutoProxyCreator, Serialized Form

Field Summary
 
Fields inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
DO_NOT_PROXY, PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS
 
Fields inherited from class org.springframework.aop.framework.ProxyConfig
exposeProxy, logger
 
Constructor Summary
BeanNameAutoProxyCreator()
           
 
Method Summary
protected  Object[] getAdvicesAndAdvisorsForBean(Class beanClass, String beanName, TargetSource targetSource)
          Identify as bean to proxy if the bean name is in the configured list of names.
protected  boolean isMatch(String beanName, String mappedName)
          Return 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.
 
Methods inherited from class org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator
createProxy, customizeProxyFactory, getBeanFactory, getCustomTargetSource, getOrder, isFrozen, isInfrastructureClass, postProcessAfterInitialization, postProcessBeforeInitialization, postProcessBeforeInstantiation, setAdvisorAdapterRegistry, setApplyCommonInterceptorsFirst, setBeanFactory, setCustomTargetSourceCreators, setFrozen, setInterceptorNames, setOrder, shouldSkip
 
Methods inherited from class org.springframework.aop.framework.ProxyConfig
copyFrom, getAopProxyFactory, isExposeProxy, isOpaque, isOptimize, isProxyTargetClass, setAopProxyFactory, setExposeProxy, setOpaque, setOptimize, setProxyTargetClass, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanNameAutoProxyCreator

public BeanNameAutoProxyCreator()
Method Detail

setBeanNames

public void setBeanNames(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".


getAdvicesAndAdvisorsForBean

protected Object[] getAdvicesAndAdvisorsForBean(Class beanClass,
                                                String beanName,
                                                TargetSource targetSource)
Identify as bean to proxy if the bean name is in the configured list of names.

Specified by:
getAdvicesAndAdvisorsForBean in 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 null if 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 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.DO_NOT_PROXY, AbstractAutoProxyCreator.PROXY_WITHOUT_ADDITIONAL_INTERCEPTORS

isMatch

protected boolean isMatch(String beanName,
                          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 check
mappedName - the name in the configured list of names
Returns:
if the names match


Copyright (c) 2002-2007 The Spring Framework Project.