public class BeanFactoryRefreshableTargetSource extends AbstractRefreshableTargetSource
Can be subclassed to override requiresRefresh()
to suppress
unnecessary refreshes. By default, a refresh will be performed every time
the "refreshCheckDelay" has elapsed.
BeanFactory
,
AbstractRefreshableTargetSource.requiresRefresh()
,
AbstractRefreshableTargetSource.setRefreshCheckDelay(long)
logger, targetObject
Constructor and Description |
---|
BeanFactoryRefreshableTargetSource(BeanFactory beanFactory,
java.lang.String beanName)
Create a new BeanFactoryRefreshableTargetSource for the given
bean factory and bean name.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
freshTarget()
Retrieve a fresh target object.
|
protected java.lang.Object |
obtainFreshBean(BeanFactory beanFactory,
java.lang.String beanName)
A template method that subclasses may override to provide a
fresh target object for the given bean factory and bean name.
|
getLastRefreshTime, getRefreshCount, getTarget, getTargetClass, isStatic, refresh, releaseTarget, requiresRefresh, setRefreshCheckDelay
public BeanFactoryRefreshableTargetSource(BeanFactory beanFactory, java.lang.String beanName)
Note that the passed-in BeanFactory should have an appropriate bean definition set up for the given bean name.
beanFactory
- the BeanFactory to fetch beans frombeanName
- the name of the target beanprotected final java.lang.Object freshTarget()
freshTarget
in class AbstractRefreshableTargetSource
protected java.lang.Object obtainFreshBean(BeanFactory beanFactory, java.lang.String beanName)
This default implementation fetches a new target bean instance from the bean factory.
BeanFactory.getBean(java.lang.String)