Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jpomykala/spring-jooq-flyway-testcontainers-junit5

🚀 Example project with configured Spring Boot, JooQ, TestContainers, MySQL container and JUnit5
https://github.com/jpomykala/spring-jooq-flyway-testcontainers-junit5

flyway java java-11 jooq junit junit5 mysql spring-boot testcontainers

Last synced: 3 months ago
JSON representation

🚀 Example project with configured Spring Boot, JooQ, TestContainers, MySQL container and JUnit5

Awesome Lists containing this project

README

        

# spring-jooq-flyway-testcontainers-junit5
Example project with configured Spring Boot, JooQ, TestContainers, flyway (as maven plugin) MySQL container and JUnit5 🚀

### Used versions
```xml
2.1.1
11
5.2.4
3.11.7
8.0.11
1.10.5
```

### Running

`mvn clean test`

Test loads first migration `V1__Init.sql` manually.

### Main test configuration

```java
@ContextConfiguration(initializers = AbstractTestConfiguration.Initializer.class)
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@JooqTest
public abstract class AbstractTestConfiguration {

@ClassRule
public static MySQLContainer mysql = new MySQLContainer().withDatabaseName("playground");

public static class Initializer implements ApplicationContextInitializer {

@Override
public void initialize(@NotNull ConfigurableApplicationContext configurableApplicationContext) {
mysql.start();
configurableApplicationContext.getEnvironment().getSystemProperties().put("spring.datasource.url", mysql.getJdbcUrl() + "?useSSL=false");
configurableApplicationContext.getEnvironment().getSystemProperties().put("spring.datasource.username", mysql.getUsername());
configurableApplicationContext.getEnvironment().getSystemProperties().put("spring.datasource.password", mysql.getPassword());
}
}
}
```