spring-framework / org.springframework.aop.target.dynamic / AbstractRefreshableTargetSource

AbstractRefreshableTargetSource

abstract class AbstractRefreshableTargetSource : TargetSource, Refreshable

Abstract org.springframework.aop.TargetSource implementation that wraps a refreshable target object. Subclasses can determine whether a refresh is required, and need to provide fresh target objects.

Implements the Refreshable interface in order to allow for explicit control over the refresh status.

Author
Rod Johnson

Author
Rob Harrop

Author
Juergen Hoeller

Since
2.0

See Also
#requiresRefresh()#freshTarget()

Constructors

<init>

AbstractRefreshableTargetSource()

Abstract org.springframework.aop.TargetSource implementation that wraps a refreshable target object. Subclasses can determine whether a refresh is required, and need to provide fresh target objects.

Implements the Refreshable interface in order to allow for explicit control over the refresh status.

Functions

getLastRefreshTime

open fun getLastRefreshTime(): Long

getRefreshCount

open fun getRefreshCount(): Long

getTarget

fun getTarget(): Any

getTargetClass

open fun getTargetClass(): Class<*>

isStatic

open fun isStatic(): Boolean

Not static.

refresh

fun refresh(): Unit

releaseTarget

open fun releaseTarget(object: Any): Unit

No need to release target.

setRefreshCheckDelay

open fun setRefreshCheckDelay(refreshCheckDelay: Long): Unit

Set the delay between refresh checks, in milliseconds. Default is -1, indicating no refresh checks at all.

Note that an actual refresh will only happen when #requiresRefresh() returns true.

Inheritors

BeanFactoryRefreshableTargetSource

open class BeanFactoryRefreshableTargetSource : AbstractRefreshableTargetSource

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.