Class QuickTargetSourceCreator
- java.lang.Object
- org.springframework.aop.framework.autoproxy.target.AbstractBeanFactoryBasedTargetSourceCreator
- org.springframework.aop.framework.autoproxy.target.QuickTargetSourceCreator
- All Implemented Interfaces:
TargetSourceCreator
,Aware
,BeanFactoryAware
,DisposableBean
public class QuickTargetSourceCreator extends AbstractBeanFactoryBasedTargetSourceCreator
Convenient TargetSourceCreator using bean name prefixes to create one of three well-known TargetSource types:- : CommonsPool2TargetSource
- % ThreadLocalTargetSource
- ! PrototypeTargetSource
- Author:
- Rod Johnson, Stephane Nicoll
- See Also:
CommonsPool2TargetSource
,ThreadLocalTargetSource
,PrototypeTargetSource
Field Summary
Fields Modifier and Type Field Description static String
PREFIX_COMMONS_POOL
The CommonsPool2TargetSource prefix.static String
PREFIX_PROTOTYPE
The PrototypeTargetSource prefix.static String
PREFIX_THREAD_LOCAL
The ThreadLocalTargetSource prefix.Fields inherited from class org.springframework.aop.framework.autoproxy.target.AbstractBeanFactoryBasedTargetSourceCreator
logger
Constructor Summary
Constructors Constructor Description QuickTargetSourceCreator()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AbstractBeanFactoryBasedTargetSource
createBeanFactoryBasedTargetSource(Class<?> beanClass, String beanName)
Subclasses must implement this method to return a new AbstractPrototypeBasedTargetSource if they wish to create a custom TargetSource for this bean, ornull
if they are not interested it in, in which case no special target source will be created.Methods inherited from class org.springframework.aop.framework.autoproxy.target.AbstractBeanFactoryBasedTargetSourceCreator
buildInternalBeanFactory, destroy, getBeanFactory, getInternalBeanFactoryForBean, getTargetSource, isPrototypeBased, setBeanFactory
Field Detail
PREFIX_COMMONS_POOL
public static final String PREFIX_COMMONS_POOL
The CommonsPool2TargetSource prefix.- See Also:
- Constant Field Values
PREFIX_THREAD_LOCAL
public static final String PREFIX_THREAD_LOCAL
The ThreadLocalTargetSource prefix.- See Also:
- Constant Field Values
PREFIX_PROTOTYPE
public static final String PREFIX_PROTOTYPE
The PrototypeTargetSource prefix.- See Also:
- Constant Field Values
Constructor Detail
QuickTargetSourceCreator
public QuickTargetSourceCreator()
Method Detail
createBeanFactoryBasedTargetSource
@Nullable protected final AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource(Class<?> beanClass, String beanName)
Description copied from class:AbstractBeanFactoryBasedTargetSourceCreator
Subclasses must implement this method to return a new AbstractPrototypeBasedTargetSource if they wish to create a custom TargetSource for this bean, ornull
if they are not interested it in, in which case no special target source will be created. Subclasses should not callsetTargetBeanName
orsetBeanFactory
on the AbstractPrototypeBasedTargetSource: This class' implementation ofgetTargetSource()
will do that.- Specified by:
createBeanFactoryBasedTargetSource
in classAbstractBeanFactoryBasedTargetSourceCreator
- Parameters:
beanClass
- the class of the bean to create a TargetSource forbeanName
- the name of the bean- Returns:
- the AbstractPrototypeBasedTargetSource, or
null
if we don't match this