@Bean | |
public DataSource dataSource() { | |
DriverManagerDataSource ds = new DriverManagerDataSource(); | |
ds.setDriverClassName("org.postgresql.Driver"); | |
// here we reference the static test container variable in our test case to get the used the connection details | |
ds.setUrl(format("jdbc:postgresql://%s:%s/%s", postgreSQLContainer.getContainerIpAddress(), | |
postgreSQLContainer.getMappedPort( | |
PostgreSQLContainer.POSTGRESQL_PORT), postgreSQLContainer.getDatabaseName())); | |
ds.setUsername(postgreSQLContainer.getUsername()); | |
ds.setPassword(postgreSQLContainer.getPassword()); | |
ds.setSchema(postgreSQLContainer.getDatabaseName()); | |
return ds; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment