Class BeanFactoryRefreshableTargetSource
java.lang.Object
org.springframework.aop.target.dynamic.AbstractRefreshableTargetSource
org.springframework.aop.target.dynamic.BeanFactoryRefreshableTargetSource
- All Implemented Interfaces:
Refreshable,TargetClassAware,TargetSource
- Direct Known Subclasses:
RefreshableScriptTargetSource
Refreshable TargetSource that fetches fresh target beans from a BeanFactory.
Can be subclassed to override requiresRefresh() to suppress
unnecessary refreshes. By default, a refresh will be performed every time
the "refreshCheckDelay" has elapsed.
- Since:
- 2.0
- Author:
- Rob Harrop, Rod Johnson, Juergen Hoeller, Mark Fisher
- See Also:
-
Field Summary
Fields inherited from class org.springframework.aop.target.dynamic.AbstractRefreshableTargetSource
logger, targetObject -
Constructor Summary
ConstructorsConstructorDescriptionBeanFactoryRefreshableTargetSource(BeanFactory beanFactory, String beanName) Create a new BeanFactoryRefreshableTargetSource for the given bean factory and bean name. -
Method Summary
Modifier and TypeMethodDescriptionprotected final ObjectRetrieve a fresh target object.protected ObjectobtainFreshBean(BeanFactory beanFactory, String beanName) A template method that subclasses may override to provide a fresh target object for the given bean factory and bean name.Methods inherited from class org.springframework.aop.target.dynamic.AbstractRefreshableTargetSource
getLastRefreshTime, getRefreshCount, getTarget, getTargetClass, refresh, requiresRefresh, setRefreshCheckDelayMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.aop.TargetSource
isStatic, releaseTarget
-
Constructor Details
-
BeanFactoryRefreshableTargetSource
Create a new BeanFactoryRefreshableTargetSource for the given bean factory and bean name.Note that the passed-in BeanFactory should have an appropriate bean definition set up for the given bean name.
- Parameters:
beanFactory- the BeanFactory to fetch beans frombeanName- the name of the target bean
-
-
Method Details
-
freshTarget
Retrieve a fresh target object.- Specified by:
freshTargetin classAbstractRefreshableTargetSource- Returns:
- the fresh target object
-
obtainFreshBean
A template method that subclasses may override to provide a fresh target object for the given bean factory and bean name.This default implementation fetches a new target bean instance from the bean factory.
- See Also:
-