public class

DatabaseStartupValidator

extends Object
implements InitializingBean
java.lang.Object
   ↳ org.springframework.jdbc.support.DatabaseStartupValidator

Class Overview

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.

Summary

Constants
int DEFAULT_INTERVAL
int DEFAULT_TIMEOUT
Fields
protected final Log logger
Public Constructors
DatabaseStartupValidator()
Public Methods
void afterPropertiesSet()
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.
void setDataSource(DataSource dataSource)
Set the DataSource to validate.
void setInterval(int interval)
Set the interval between validation runs (in seconds).
void setTimeout(int timeout)
Set the timeout (in seconds) after which a fatal exception will be thrown.
void setValidationQuery(String validationQuery)
Set the SQL query string to use for validation.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.beans.factory.InitializingBean

Constants

public static final int DEFAULT_INTERVAL

Constant Value: 1 (0x00000001)

public static final int DEFAULT_TIMEOUT

Constant Value: 60 (0x0000003c)

Fields

protected final Log logger

Public Constructors

public DatabaseStartupValidator ()

Public Methods

public void afterPropertiesSet ()

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.

public void setDataSource (DataSource dataSource)

Set the DataSource to validate.

public void setInterval (int interval)

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

public void setTimeout (int timeout)

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

public void setValidationQuery (String validationQuery)

Set the SQL query string to use for validation.