Improve null-safety of core/spring-boot-testcontainers
See gh-46926
This commit is contained in:
parent
717ddac137
commit
dc3fe1b17d
|
@ -193,12 +193,13 @@ public abstract class ContainerConnectionDetailsFactory<C extends Container<?>,
|
|||
* @return the container instance
|
||||
*/
|
||||
protected final C getContainer() {
|
||||
Assert.state(this.container != null,
|
||||
C container = this.container;
|
||||
Assert.state(container != null,
|
||||
"Container cannot be obtained before the connection details bean has been initialized");
|
||||
if (this.container instanceof Startable startable) {
|
||||
if (container instanceof Startable startable) {
|
||||
TestcontainersStartup.start(startable);
|
||||
}
|
||||
return this.container;
|
||||
return container;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue