Top Description Fields Constructors Methods
org.springframework.aop.target.dynamic

public Class BeanFactoryRefreshableTargetSource

extends AbstractRefreshableTargetSource
Class Inheritance
Imports
org.springframework.beans.factory.BeanFactory, org.springframework.util.Assert

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.

Authors
Rob Harrop, Rod Johnson, Juergen Hoeller, Mark Fisher
Since
2.0
See Also
org.springframework.beans.factory.BeanFactory, requiresRefresh(), setRefreshCheckDelay

Field Summary

Modifier and TypeField and Description
private final BeanFactory
private final String
Inherited from org.springframework.aop.target.dynamic.AbstractRefreshableTargetSource:
loggertargetObject

Constructor Summary

AccessConstructor and Description
public
BeanFactoryRefreshableTargetSource(BeanFactory
the BeanFactory to fetch beans from
beanFactory
,
String
the name of the target bean
beanName
)

Create a new BeanFactoryRefreshableTargetSource for the given bean factory and bean name.

Method Summary

Modifier and TypeMethod and Description
protected final 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.

Inherited from org.springframework.aop.target.dynamic.AbstractRefreshableTargetSource:
getLastRefreshTimegetRefreshCountgetTargetgetTargetClassrefreshrequiresRefreshsetRefreshCheckDelay

Field Detail

beanFactoryback to summary
private final BeanFactory beanFactory
beanNameback to summary
private final String beanName

Constructor Detail

BeanFactoryRefreshableTargetSourceback to summary
public BeanFactoryRefreshableTargetSource(BeanFactory beanFactory, String beanName)

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:BeanFactory

the BeanFactory to fetch beans from

beanName:String

the name of the target bean

Method Detail

freshTargetback to summary
protected final Object freshTarget()

Implements abstract org.springframework.aop.target.dynamic.AbstractRefreshableTargetSource.freshTarget.

Retrieve a fresh target object.

Returns:Object

Doc from org.springframework.aop.target.dynamic.AbstractRefreshableTargetSource.freshTarget.

the fresh target object

Annotations
@Override
obtainFreshBeanback to summary
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.

This default implementation fetches a new target bean instance from the bean factory.

See Also
org.springframework.beans.factory.BeanFactory#getBean