Skip to content

Commit

Permalink
@TestConfiguration Configuration commented out
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebrownccd committed Dec 7, 2023
1 parent 4894472 commit bcca91f
Showing 1 changed file with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,36 +90,36 @@ public abstract class BaseTest {
// Force re-initialisation of base types for each test suite
}

@TestConfiguration
static class Configuration {
Connection connection;

@Bean
public EmbeddedPostgres embeddedPostgres() throws IOException {
return EmbeddedPostgres
.builder()
.start();
}

@Bean
public DataSource dataSource(@Autowired EmbeddedPostgres pg) throws Exception {

final Properties props = new Properties();
// Instruct JDBC to accept JSON string for JSONB
props.setProperty("stringtype", "unspecified");
props.setProperty("user", "postgres");
connection = DriverManager.getConnection(pg.getJdbcUrl("postgres"), props);
return new SingleConnectionDataSource(connection, true);
}

@PreDestroy
public void contextDestroyed() throws SQLException {
if (connection != null) {
connection.close();
}
}
}
// @TestConfiguration
// static class Configuration {
// Connection connection;
//
// @Bean
// public EmbeddedPostgres embeddedPostgres() throws IOException {
// return EmbeddedPostgres
// .builder()
// .start();
// }
//
// @Bean
// public DataSource dataSource(@Autowired EmbeddedPostgres pg) throws Exception {
//
// final Properties props = new Properties();
// // Instruct JDBC to accept JSON string for JSONB
// props.setProperty("stringtype", "unspecified");
// props.setProperty("user", "postgres");
// connection = DriverManager.getConnection(pg.getJdbcUrl("postgres"), props);
// return new SingleConnectionDataSource(connection, true);
// }
//
//
// @PreDestroy
// public void contextDestroyed() throws SQLException {
// if (connection != null) {
// connection.close();
// }
// }
// }

public static class WireMockServerInitializer
implements ApplicationContextInitializer<ConfigurableApplicationContext> {
Expand Down

0 comments on commit bcca91f

Please sign in to comment.