Polish "Prevent container to be closed twice"
See gh-35120
This commit is contained in:
@@ -23,7 +23,7 @@ import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
/**
|
||||
* {@link ApplicationContextInitializer} to manage the lifecycle of {@link Startable
|
||||
* startable container}.
|
||||
* startable containers}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 3.1.0
|
||||
|
||||
@@ -20,16 +20,16 @@ import org.testcontainers.lifecycle.Startable;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;
|
||||
|
||||
/**
|
||||
* {@link BeanPostProcessor} to manage the lifecycle of {@link Startable startable
|
||||
* container}.
|
||||
* containers}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Stephane Nicoll
|
||||
* @see TestcontainersLifecycleApplicationContextInitializer
|
||||
*/
|
||||
class TestcontainersLifecycleBeanPostProcessor implements DestructionAwareBeanPostProcessor {
|
||||
class TestcontainersLifecycleBeanPostProcessor implements BeanPostProcessor {
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
@@ -39,14 +39,4 @@ class TestcontainersLifecycleBeanPostProcessor implements DestructionAwareBeanPo
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postProcessBeforeDestruction(Object bean, String beanName) throws BeansException {
|
||||
// Startable extends AutoCloseable will always be closed by context
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requiresDestruction(Object bean) {
|
||||
return bean instanceof Startable;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user