spring-projects-experimental / spring-fu

Configuration DSLs for Spring Boot
Apache License 2.0
1.67k stars 139 forks source link

Database Population Error #344

Closed Kotlin-GDE closed 3 years ago

Kotlin-GDE commented 3 years ago

hi @sdeleuze

i try to populte database r2dbc with postgresql, i declare a bean to initialize database schema like this

bean {
            ConnectionFactoryInitializer().apply {
                setConnectionFactory(ref())
                setDatabasePopulator(ResourceDatabasePopulator(ClassPathResource("data/schema.sql")))
            }
        }

when start application, this bean is not initialised so database schema (tables.sql) not execute and application fail (tables not created )

Kotlin-GDE commented 3 years ago

issue resole (because usage of main.lazy-initialization = true, this bean is not create in startup and database schema not created)