Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.02 KB

README.md

File metadata and controls

48 lines (34 loc) · 1.02 KB

Spring JPA with local PostgreSQL

This is all you need to set up PostgreSQL container that will start along with your application.

Local Application code

fun main(args: Array<String>) {
	runApplication<Application>(*args) {
		addInitializers(PostgreSQLInitializer())
	}
}

Full code

Test code

@SpringBootTest
@ContextConfiguration(initializers = [PostgreSQLInitializer::class])
@AutoConfigureMockMvc
internal class CatControllerTest {

}

Full code

Gradle dependencies

dependencies {
    testImplementation(platform("org.testcontainers:testcontainers-bom:1.19.5"))
    testImplementation("org.testcontainers:postgresql")
}

Full code

How to run it locally?

All modules share common Gradle wrapper and configuration. Go back to repository's main directory and run:

./gradlew local-db:bootLocalRun