接口的使用
org.springframework.jdbc.datasource.init.DatabasePopulator
使用DatabasePopulator的程序包 程序包 说明 org.springframework.jdbc.datasource.embedded Provides extensible support for creating embedded database instances.org.springframework.jdbc.datasource.init Provides extensible support for initializing databases through scripts.org.springframework.jdbc.datasource.embedded中DatabasePopulator的使用
参数类型为DatabasePopulator的org.springframework.jdbc.datasource.embedded中的方法 修饰符和类型 方法 说明 voidEmbeddedDatabaseFactoryBean. setDatabaseCleaner(DatabasePopulator databaseCleaner)Set a script execution to be run in the bean destruction callback, cleaning up the database and leaving it in a known state for others.voidEmbeddedDatabaseFactory. setDatabasePopulator(DatabasePopulator populator)Set the strategy that will be used to initialize or populate the embedded database.org.springframework.jdbc.datasource.init中DatabasePopulator的使用
实现DatabasePopulator的org.springframework.jdbc.datasource.init中的类 修饰符和类型 类 说明 classCompositeDatabasePopulatorCompositeDatabasePopulatorthat delegates to a list of givenDatabasePopulatorimplementations, executing all scripts.classResourceDatabasePopulatorPopulates, initializes, or cleans up a database using SQL scripts defined in external resources.参数类型为DatabasePopulator的org.springframework.jdbc.datasource.init中的方法 修饰符和类型 方法 说明 voidCompositeDatabasePopulator. addPopulators(DatabasePopulator... populators)Add one or more populators to the list of delegates.static voidDatabasePopulatorUtils. execute(DatabasePopulator populator, DataSource dataSource)Execute the givenDatabasePopulatoragainst the givenDataSource.voidDataSourceInitializer. setDatabaseCleaner(DatabasePopulator databaseCleaner)Set theDatabasePopulatorto execute during the bean destruction phase, cleaning up the database and leaving it in a known state for others.voidDataSourceInitializer. setDatabasePopulator(DatabasePopulator databasePopulator)Set theDatabasePopulatorto execute during the bean initialization phase.voidCompositeDatabasePopulator. setPopulators(DatabasePopulator... populators)Specify one or more populators to delegate to.参数类型为DatabasePopulator的org.springframework.jdbc.datasource.init中的构造器 构造器 说明 CompositeDatabasePopulator(DatabasePopulator... populators)Create aCompositeDatabasePopulatorwith the given populators.类型变量类型为DatabasePopulator的org.springframework.jdbc.datasource.init中的构造器参数 构造器 说明 CompositeDatabasePopulator(Collection<DatabasePopulator> populators)Create aCompositeDatabasePopulatorwith the given populators.