This is all you need to set up PostgreSQL container that will start along with your application.
fun main(args: Array<String>) {
runApplication<Application>(*args) {
addInitializers(PostgreSQLInitializer())
}
}
@SpringBootTest
@ContextConfiguration(initializers = [PostgreSQLInitializer::class])
@AutoConfigureMockMvc
internal class CatControllerTest {
}
dependencies {
testImplementation(platform("org.testcontainers:testcontainers-bom:1.19.5"))
testImplementation("org.testcontainers:postgresql")
}
All modules share common Gradle wrapper and configuration. Go back to repository's main directory and run:
./gradlew local-db:bootLocalRun