Class ContainerShutdownCloseable

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public final class ContainerShutdownCloseable
    extends Object
    implements Closeable
    Helper to define the stop strategy for containers created by DevServices. In particular we don't want to actually stop the containers when they have been flagged for reuse, and when the Testcontainers configuration has been explicitly set to allow container reuse. To enable reuse, ass testcontainers.reuse.enable=true in your .testcontainers.properties file, to be stored in your home.
    See Also:
    Testcontainers Configuration.
    • Constructor Detail

      • ContainerShutdownCloseable

        public ContainerShutdownCloseable​(org.testcontainers.containers.GenericContainer container,
                                          String friendlyServiceName)
        Parameters:
        container - the container to be eventually closed
        friendlyServiceName - for logging purposes