Dear Spring Boot team,
with the refactoring of the datasource initialization you introduced an incompatible change regarding the datasource DDL initialization. Earlier the DDL initialization was performed directly after the initilization of the datasource which we assume was achieved by the DataSourceInitializerPostProcessor
. Now the datasource initialization is executed by the DataSourceScriptDatabaseInitializer
which is an InitializingBean
that runs at some (random?) point during initialization. This leads to the problem that you get a datasource during initialization that is not initialized with the DDL statements causing SQL errors.
Best regards, Marcel
Comment From: wilkinsona
If you use the DataSource
via JdbcTemplate
, JPA, jOOQ, etc, it's guaranteed that the DataSource
will have been initialized before it's used. If you're working with the DataSource
directly you can use @DependsOnDatabaseInitialization
on a bean's class or @Bean
method to indicate that the bean should be initialized after the datasource. This is described in the documentation but we should mention it in the release notes as well. We can use this issue to do that.
Comment From: wilkinsona
I've added a note about initialization ordering to the release notes.
Comment From: MarcelMerkle
Thank you!