类 DatabaseStartupValidator
- java.lang.Object
- org.springframework.jdbc.support.DatabaseStartupValidator
- 所有已实现的接口:
InitializingBean
public class DatabaseStartupValidator extends Object implements 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.
- 从以下版本开始:
- 18.12.2003
- 作者:
- Juergen Hoeller
字段概要
字段 修饰符和类型 字段 说明 static int
DEFAULT_INTERVAL
static int
DEFAULT_TIMEOUT
protected Log
logger
构造器概要
构造器 构造器 说明 DatabaseStartupValidator()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.
字段详细资料
DEFAULT_INTERVAL
public static final int DEFAULT_INTERVAL
- 另请参阅:
- 常量字段值
DEFAULT_TIMEOUT
public static final int DEFAULT_TIMEOUT
- 另请参阅:
- 常量字段值
构造器详细资料
DatabaseStartupValidator
public DatabaseStartupValidator()
方法详细资料
setDataSource
public void setDataSource(DataSource dataSource)
Set the DataSource to validate.
setValidationQuery
public void setValidationQuery(String validationQuery)
Set the SQL query string to use for validation.
setInterval
public void setInterval(int interval)
Set the interval between validation runs (in seconds). Default is 1.
setTimeout
public void setTimeout(int timeout)
Set the timeout (in seconds) after which a fatal exception will be thrown. Default is 60.
afterPropertiesSet
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.- 指定者:
afterPropertiesSet
在接口中InitializingBean