Skip to content

Instantly share code, notes, and snippets.

View stackunderflow111's full-sized avatar

stackunderflow111

View GitHub Profile
@stackunderflow111
stackunderflow111 / build.gradle.kts
Last active October 14, 2025 19:26
Integrate Jooq with Testcontainers and Flyway
import nu.studer.gradle.jooq.JooqGenerate
import org.flywaydb.core.Flyway
import org.flywaydb.core.api.configuration.FluentConfiguration
import org.jooq.meta.jaxb.Configuration
import org.testcontainers.containers.JdbcDatabaseContainer
import org.testcontainers.containers.PostgreSQLContainer
import org.testcontainers.utility.DockerImageName
plugins {
id("nu.studer.jooq") version "7.1.1"
@stackunderflow111
stackunderflow111 / PostgresContainerExtension.java
Created November 19, 2021 03:25
Testcontainers extension
public class PostgresContainerExtension implements BeforeAllCallback {
static private final PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:13-alpine");
@Override
public void beforeAll(ExtensionContext context) {
postgres.start();
System.setProperty("spring.datasource.url", postgres.getJdbcUrl());
System.setProperty("spring.datasource.username", postgres.getUsername());
System.setProperty("spring.datasource.password", postgres.getPassword());