Adds spring-boot-testcontainers and testcontainers-postgresql deps. PostgresContainerConfig declares a shared @ServiceConnection container used by DocumentRepositoryTest, PersonRepositoryTest, and an ApplicationContextTest smoke test. Flyway migrations are imported via FlywayConfig and run on every test execution, verifying the migration chain against a real PostgreSQL 16 container. No H2 is used. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
17 lines
536 B
Java
17 lines
536 B
Java
package org.raddatz.familienarchiv;
|
|
|
|
import org.springframework.boot.test.context.TestConfiguration;
|
|
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.testcontainers.containers.PostgreSQLContainer;
|
|
|
|
@TestConfiguration(proxyBeanMethods = false)
|
|
public class PostgresContainerConfig {
|
|
|
|
@Bean
|
|
@ServiceConnection
|
|
PostgreSQLContainer<?> postgresContainer() {
|
|
return new PostgreSQLContainer<>("postgres:16-alpine");
|
|
}
|
|
}
|