org.springframework.r2dbc.connection.init

## Class CompositeDatabasePopulator

- java.lang.Object
- - org.springframework.r2dbc.connection.init.CompositeDatabasePopulator

- All Implemented Interfaces:
    DatabasePopulator

      public class CompositeDatabasePopulator
      extends Object
      implements 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

    Constructors
    Constructor and Description
    `CompositeDatabasePopulator()` Create an empty `CompositeDatabasePopulator`.
    `CompositeDatabasePopulator(Collection<DatabasePopulator> populators)` Create a `CompositeDatabasePopulator`.
    `CompositeDatabasePopulator(DatabasePopulator... populators)` Create a `CompositeDatabasePopulator` with the given populators.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPopulators(DatabasePopulator... populators)` Add one or more populators to the list of delegates.
    `reactor.core.publisher.Mono<Void>` | `populate(io.r2dbc.spi.Connection connection)` Populate, initialize, or clean up the database using the provided R2DBC `Connection`.
    `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 Detail

    - #### CompositeDatabasePopulator

          public CompositeDatabasePopulator()

      Create an empty `CompositeDatabasePopulator`.
      See Also:
        `setPopulators(org.springframework.r2dbc.connection.init.DatabasePopulator...)`, `addPopulators(org.springframework.r2dbc.connection.init.DatabasePopulator...)`

    - #### CompositeDatabasePopulator

          public CompositeDatabasePopulator(Collection<DatabasePopulator> populators)

      Create a `CompositeDatabasePopulator`. with the given populators.
      Parameters:
        `populators` - one or more populators to delegate to.

    - #### CompositeDatabasePopulator

          public CompositeDatabasePopulator(DatabasePopulator... populators)

      Create a `CompositeDatabasePopulator` with the given populators.
      Parameters:
        `populators` - one or more populators to delegate to.

  - ### Method Detail

    - #### 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 reactor.core.publisher.Mono<Void> populate(io.r2dbc.spi.Connection connection)
                                                     throws ScriptException

      Description copied from interface: `DatabasePopulator`
      Populate, initialize, or clean up the database using the provided R2DBC `Connection`.
      Specified by:
        `populate` in interface `DatabasePopulator`
      Parameters:
        `connection` - the R2DBC connection to use to populate the db; already configured and ready to use, must not be `null`
      Returns:
        `Mono` that initiates script execution and is notified upon completion
      Throws:
        `ScriptException` - in case of any errors