jwi :
Let's assume I have the following container in my integration test (JUnit 5):
@Container
private static GenericContainer databaseContainer =
new GenericContainer("oscarfonts/h2:latest")
.withExposedPorts(H2_TCP_PORT, H2_WEB_PORT);
With this the container will start automatically. Is there a way to tell testcontainers not to start the container automatically?
Shmulik Klein :
Yes, the @Container
annotation is just used to start the container before your tests and tears it down afterwards.
An alternative would be to instantiate the databaseContainer
and later on start()
it manually - Manual Container Lifecycle Control
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326512&siteId=1