Created
November 19, 2021 03:25
-
-
Save stackunderflow111/a34e31b103135fde3955cad6a1330f88 to your computer and use it in GitHub Desktop.
Testcontainers extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment