类 CompositeDatabasePopulator
- java.lang.Object
- org.springframework.jdbc.datasource.init.CompositeDatabasePopulator
- 所有已实现的接口:
DatabasePopulator
public class CompositeDatabasePopulator extends Object implements DatabasePopulator
CompositeDatabasePopulatorthat delegates to a list of givenDatabasePopulatorimplementations, executing all scripts.- 从以下版本开始:
- 3.1
- 作者:
- Dave Syer, Juergen Hoeller, Sam Brannen, Kazuki Shimizu
构造器概要
构造器 构造器 说明 CompositeDatabasePopulator()Create an emptyCompositeDatabasePopulator.CompositeDatabasePopulator(Collection<DatabasePopulator> populators)Create aCompositeDatabasePopulatorwith the given populators.CompositeDatabasePopulator(DatabasePopulator... populators)Create aCompositeDatabasePopulatorwith the given populators.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddPopulators(DatabasePopulator... populators)Add one or more populators to the list of delegates.voidpopulate(Connection connection)Populate, initialize, or clean up the database using the provided JDBC connection.voidsetPopulators(DatabasePopulator... populators)Specify one or more populators to delegate to.
构造器详细资料
CompositeDatabasePopulator
public CompositeDatabasePopulator()
Create an emptyCompositeDatabasePopulator.
CompositeDatabasePopulator
public CompositeDatabasePopulator(Collection<DatabasePopulator> populators)
Create aCompositeDatabasePopulatorwith the given populators.- 参数:
populators- one or more populators to delegate to- 从以下版本开始:
- 4.3
CompositeDatabasePopulator
public CompositeDatabasePopulator(DatabasePopulator... populators)
Create aCompositeDatabasePopulatorwith the given populators.- 参数:
populators- one or more populators to delegate to- 从以下版本开始:
- 4.3
方法详细资料
setPopulators
public void setPopulators(DatabasePopulator... populators)
Specify one or more populators to delegate to.
addPopulators
public void addPopulators(DatabasePopulator... populators)
Add one or more populators to the list of delegates.
populate
public void populate(Connection connection) throws SQLException, ScriptException
从接口复制的说明:DatabasePopulatorPopulate, initialize, or clean up the database using the provided JDBC connection.Concrete implementations may throw an
SQLExceptionif an error is encountered but are strongly encouraged to throw a specificScriptExceptioninstead. For example, Spring'sResourceDatabasePopulatorandDatabasePopulatorUtilswrap allSQLExceptionsinScriptExceptions.- 指定者:
populate在接口中DatabasePopulator- 参数:
connection- the JDBC connection to use to populate the db; already configured and ready to use; nevernull- 抛出:
SQLException- if an unrecoverable data access exception occurs during database populationScriptException- in all other error cases- 另请参阅:
DatabasePopulatorUtils.execute(org.springframework.jdbc.datasource.init.DatabasePopulator, javax.sql.DataSource)