Files
spring-boot-demo/data-jpa-testcontainers/docs/output/01-postgresqlcontainer-relocation-javap.txt
Claude 4370ac7fdf Correct post #45: Flyway and Liquibase DO run under @DataJpaTest by default
The previous commit's FlywayDoesNotRunUnderPlainDataJpaTestTest and
FlywayRunsWhenExplicitlyImportedTest rested on a false premise: that none of
@DataJpaTest's four documented meta-annotations import FlywayAutoConfiguration,
so migrations never run under the slice. That reading of the four .imports
manifests is accurate but incomplete. @AutoConfigureJdbc is itself
meta-annotated with @AutoConfigureDataSourceInitialization (new in Boot 4.0),
and Spring's ImportAutoConfigurationImportSelector walks the full
meta-annotation tree transitively. That fifth annotation's own .imports
resource is loaded via ClassLoader.getResources(), which merges same-named
files from every jar on the classpath -- spring-boot-jdbc-test,
spring-boot-flyway and spring-boot-liquibase each ship one at the identical
path, contributing DataSourceInitializationAutoConfiguration,
FlywayAutoConfiguration and LiquibaseAutoConfiguration respectively.

Replaced the two wrong-premise test classes with FlywayRunsByDefaultTest
(proves the bean is present and the migration actually ran) and
ExplicitFlywayImportIsRedundantTest (proves the old "add the import yourself"
advice is harmless but unnecessary on Boot 4.1). Added javap/unzip evidence
for the new mechanism to docs/output, re-captured the full test run (9 tests,
1 clean skip), corrected README's test table, and closed a second,
unrelated gap: the unzip -l listing quoted in the @ServiceConnection section
had no matching captured transcript -- it does now.
2026-10-08 12:35:04 +00:00

83 lines
4.8 KiB
Plaintext

$ javap -p org/testcontainers/postgresql/PostgreSQLContainer.class # testcontainers-postgresql-2.0.5.jar
Compiled from "PostgreSQLContainer.java"
public class org.testcontainers.postgresql.PostgreSQLContainer extends org.testcontainers.containers.JdbcDatabaseContainer<org.testcontainers.postgresql.PostgreSQLContainer> {
public static final java.lang.String NAME;
public static final java.lang.String IMAGE;
public static final java.lang.String DEFAULT_TAG;
private static final org.testcontainers.utility.DockerImageName DEFAULT_IMAGE_NAME;
private static final org.testcontainers.utility.DockerImageName PGVECTOR_IMAGE_NAME;
public static final java.lang.Integer POSTGRESQL_PORT;
static final java.lang.String DEFAULT_USER;
static final java.lang.String DEFAULT_PASSWORD;
private java.lang.String databaseName;
private java.lang.String username;
private java.lang.String password;
private static final java.lang.String FSYNC_OFF_OPTION;
public org.testcontainers.postgresql.PostgreSQLContainer(java.lang.String);
public org.testcontainers.postgresql.PostgreSQLContainer(org.testcontainers.utility.DockerImageName);
protected java.util.Set<java.lang.Integer> getLivenessCheckPorts();
protected void configure();
public java.lang.String getDriverClassName();
public java.lang.String getJdbcUrl();
public java.lang.String getDatabaseName();
public java.lang.String getUsername();
public java.lang.String getPassword();
public java.lang.String getTestQueryString();
public org.testcontainers.postgresql.PostgreSQLContainer withDatabaseName(java.lang.String);
public org.testcontainers.postgresql.PostgreSQLContainer withUsername(java.lang.String);
public org.testcontainers.postgresql.PostgreSQLContainer withPassword(java.lang.String);
protected void waitUntilContainerStarted();
public org.testcontainers.containers.JdbcDatabaseContainer withDatabaseName(java.lang.String);
public org.testcontainers.containers.JdbcDatabaseContainer withPassword(java.lang.String);
public org.testcontainers.containers.JdbcDatabaseContainer withUsername(java.lang.String);
static {};
}
$ javap -p org/testcontainers/containers/PostgreSQLContainer.class # SAME jar, deprecated shim
Compiled from "PostgreSQLContainer.java"
public class org.testcontainers.containers.PostgreSQLContainer<SELF extends org.testcontainers.containers.PostgreSQLContainer<SELF>> extends org.testcontainers.containers.JdbcDatabaseContainer<SELF> {
public static final java.lang.String NAME;
public static final java.lang.String IMAGE;
public static final java.lang.String DEFAULT_TAG;
private static final org.testcontainers.utility.DockerImageName DEFAULT_IMAGE_NAME;
private static final org.testcontainers.utility.DockerImageName PGVECTOR_IMAGE_NAME;
public static final java.lang.Integer POSTGRESQL_PORT;
static final java.lang.String DEFAULT_USER;
static final java.lang.String DEFAULT_PASSWORD;
private java.lang.String databaseName;
private java.lang.String username;
private java.lang.String password;
private static final java.lang.String FSYNC_OFF_OPTION;
public org.testcontainers.containers.PostgreSQLContainer();
public org.testcontainers.containers.PostgreSQLContainer(java.lang.String);
public org.testcontainers.containers.PostgreSQLContainer(org.testcontainers.utility.DockerImageName);
protected java.util.Set<java.lang.Integer> getLivenessCheckPorts();
protected void configure();
public java.lang.String getDriverClassName();
public java.lang.String getJdbcUrl();
public java.lang.String getDatabaseName();
public java.lang.String getUsername();
public java.lang.String getPassword();
public java.lang.String getTestQueryString();
public SELF withDatabaseName(java.lang.String);
public SELF withUsername(java.lang.String);
public SELF withPassword(java.lang.String);
protected void waitUntilContainerStarted();
public org.testcontainers.containers.JdbcDatabaseContainer withDatabaseName(java.lang.String);
public org.testcontainers.containers.JdbcDatabaseContainer withPassword(java.lang.String);
public org.testcontainers.containers.JdbcDatabaseContainer withUsername(java.lang.String);
static {};
}
$ javap -v org/testcontainers/containers/PostgreSQLContainer.class | grep -i deprecated
#7 = Utf8 Ljava/lang/Deprecated;
#232 = Utf8 Deprecated
Deprecated: true
java.lang.Deprecated
Deprecated: true
$ unzip -l /root/.m2/repository/org/testcontainers/testcontainers-postgresql/2.0.5/testcontainers-postgresql-2.0.5.jar | grep PostgreSQLContainer
5533 2026-04-06 22:36 org/testcontainers/postgresql/PostgreSQLContainer.class
1745 2026-04-06 22:36 org/testcontainers/containers/PostgreSQLContainerProvider.class
6150 2026-04-06 22:36 org/testcontainers/containers/PostgreSQLContainer.class