17 Temmuz 2023 Pazartesi

SpringBoot Test @DataMongoTest Anotasyonu

Örnek
Şöyle yaparız
@Testcontainers
@DataMongoTest(excludeAutoConfiguration = MongoAutoConfiguration.class)
public class MongoTestEnvironment {
  public static MongoDBContainer mongoDBContainer = new MongoDBContainer(
    DockerImageName.parse(PropertyFileLoader
      .getProperty("mongo.db.docker.image"))).withReuse(true);
}

public class TestEnvironment extends MongoTestEnvironment {
  ...
}

Hiç yorum yok:

Yorum Gönder