spring-framework / org.springframework.jdbc.support / DatabaseStartupValidator

DatabaseStartupValidator

open class DatabaseStartupValidator : InitializingBean

Bean that checks if a database has already started up. To be referenced via "depends-on" from beans that depend on database startup, like a Hibernate SessionFactory or custom data access objects that access a DataSource directly.

Useful to defer application initialization until a database has started up. Particularly appropriate for waiting on a slowly starting Oracle database.

Author
Juergen Hoeller

Since
18.12.2003

Constructors

<init>

DatabaseStartupValidator()

Bean that checks if a database has already started up. To be referenced via "depends-on" from beans that depend on database startup, like a Hibernate SessionFactory or custom data access objects that access a DataSource directly.

Useful to defer application initialization until a database has started up. Particularly appropriate for waiting on a slowly starting Oracle database.

Properties

DEFAULT_INTERVAL

static val DEFAULT_INTERVAL: Int

DEFAULT_TIMEOUT

static val DEFAULT_TIMEOUT: Int

Functions

afterPropertiesSet

open fun afterPropertiesSet(): Unit

Check whether the validation query can be executed on a Connection from the specified DataSource, with the specified interval between checks, until the specified timeout.

setDataSource

open fun setDataSource(dataSource: DataSource): Unit

Set the DataSource to validate.

setInterval

open fun setInterval(interval: Int): Unit

Set the interval between validation runs (in seconds). Default is 1.

setTimeout

open fun setTimeout(timeout: Int): Unit

Set the timeout (in seconds) after which a fatal exception will be thrown. Default is 60.

setValidationQuery

open fun setValidationQuery(validationQuery: String): Unit

Set the SQL query string to use for validation.