Class CompositeDatabasePopulator
java.lang.Object
org.springframework.r2dbc.connection.init.CompositeDatabasePopulator
- All Implemented Interfaces:
DatabasePopulator
Composite
DatabasePopulator
that delegates to a list of given
DatabasePopulator
implementations, executing all scripts.- Since:
- 5.3
- Author:
- Dave Syer, Juergen Hoeller, Sam Brannen, Kazuki Shimizu, Mark Paluch
-
Constructor Summary
ConstructorDescriptionCreate an emptyCompositeDatabasePopulator
.CompositeDatabasePopulator
(Collection<DatabasePopulator> populators) Create aCompositeDatabasePopulator
.CompositeDatabasePopulator
(DatabasePopulator... populators) Create aCompositeDatabasePopulator
with the given populators. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPopulators
(DatabasePopulator... populators) Add one or more populators to the list of delegates.reactor.core.publisher.Mono<Void>
populate
(Connection connection) Populate, initialize, or clean up the database using the provided R2DBCConnection
.void
setPopulators
(DatabasePopulator... populators) Specify one or more populators to delegate to.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.r2dbc.connection.init.DatabasePopulator
populate
-
Constructor Details
-
CompositeDatabasePopulator
public CompositeDatabasePopulator()Create an emptyCompositeDatabasePopulator
. -
CompositeDatabasePopulator
Create aCompositeDatabasePopulator
. with the given populators.- Parameters:
populators
- one or more populators to delegate to.
-
CompositeDatabasePopulator
Create aCompositeDatabasePopulator
with the given populators.- Parameters:
populators
- one or more populators to delegate to.
-
-
Method Details
-
setPopulators
Specify one or more populators to delegate to. -
addPopulators
Add one or more populators to the list of delegates. -
populate
Description copied from interface:DatabasePopulator
Populate, initialize, or clean up the database using the provided R2DBCConnection
.- Specified by:
populate
in interfaceDatabasePopulator
- Parameters:
connection
- the R2DBC connection to use to populate the db; already configured and ready to use, must not benull
- Returns:
Mono
that initiates script execution and is notified upon completion- Throws:
ScriptException
- in case of any errors
-