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,
String beanName)
Create a new BeanFactoryRefreshableTargetSource for the given
bean factory and bean name.
|
Modifier and Type | Method and Description |
---|---|
protected Object |
freshTarget()
Retrieve a fresh target object.
|
protected Object |
obtainFreshBean(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.
|
getLastRefreshTime, getRefreshCount, getTarget, getTargetClass, isStatic, refresh, releaseTarget, requiresRefresh, setRefreshCheckDelay
public BeanFactoryRefreshableTargetSource(BeanFactory beanFactory, 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 Object freshTarget()
freshTarget
in class AbstractRefreshableTargetSource
protected Object obtainFreshBean(BeanFactory beanFactory, String beanName)
This default implementation fetches a new target bean instance from the bean factory.