Class ContainerShutdownCloseable

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public 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:
    Reusable Containers, 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