Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.jdbc.datasource.init
Class DataSourceInitializer

    java.lang.Object
      org.springframework.jdbc.datasource.init.DataSourceInitializer

All Implemented Interfaces:
  InitializingBean

    public class DataSourceInitializer

extends Object
implements InitializingBean

Used to populate a database during initialization.

Since:
  3.0
Author:
  Dave Syer
See Also:
  `DatabasePopulator`

Constructor Summary
`DataSourceInitializer()`

Method Summary
`void` | `afterPropertiesSet()` Use the populator to set up data in the data source.
`void` | `setDatabasePopulator(DatabasePopulator databasePopulator)` The `DatabasePopulator` to use to populate the data source.
`void` | `setDataSource(DataSource dataSource)` The `DataSource` to populate when this component is initialized.
`void` | `setEnabled(boolean enabled)` Flag to explicitly enable or disable the database populator.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DataSourceInitializer

    public DataSourceInitializer()

Method Detail

### setDataSource

    public void setDataSource(DataSource dataSource)

  The `DataSource` to populate when this component is initialized. Mandatory with no default.

  Parameters:
    `dataSource` - the DataSource

### setDatabasePopulator

    public void setDatabasePopulator(DatabasePopulator databasePopulator)

  The `DatabasePopulator` to use to populate the data source. Mandatory with no default.

  Parameters:
    `databasePopulator` - the database populator to use.

### setEnabled

    public void setEnabled(boolean enabled)

  Flag to explicitly enable or disable the database populator.

  Parameters:
    `enabled` - true if the database populator will be called on startup

### afterPropertiesSet

    public void afterPropertiesSet()
                            throws Exception

  Use the populator to set up data in the data source.

  Specified by:
    `afterPropertiesSet` in interface `InitializingBean`
  Throws:
    `Exception` - in the event of misconfiguration (such as failure to set an essential property) or if initialization fails.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD