From 03a87ccd69ec8e4792c3e68c388d3794664dd698 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 17 Jun 2024 10:45:03 +0100 Subject: [PATCH] Clarify how Container's Docker image name is used to name a connection Closes gh-41111 --- .../spring-boot-docs/src/docs/asciidoc/features/testing.adoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testing.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testing.adoc index 403c3c8d7ad..a05cc18214e 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testing.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testing.adoc @@ -1040,7 +1040,8 @@ For example, a `PostgreSQLContainer` will create both `JdbcConnectionDetails` an If you want to create only a subset of the applicable types, you can use the `type` attribute of `@ServiceConnection`. ==== -By default `Container.getDockerImageName()` is used to obtain the name used to find connection details. +By default `Container.getDockerImageName().getRepository()` is used to obtain the name used to find connection details. +The repository portion of the Docker image name ignores any registry and the version. This works as long as Spring Boot is able to get the instance of the `Container`, which is the case when using a `static` field like in the example above. If you're using a `@Bean` method, Spring Boot won't call the bean method to get the Docker image name, because this would cause eager initialization issues.