diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/anchor-rewrite.properties b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/anchor-rewrite.properties index 72cfd12eaa94..783ff820a907 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/anchor-rewrite.properties +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/anchor-rewrite.properties @@ -1037,3 +1037,9 @@ deployment.installing.nix-services.script-customization=deployment.installing.in deployment.installing.nix-services.script-customization.when-written=deployment.installing.init-d.script-customization.when-written deployment.installing.nix-services.script-customization.when-running=deployment.installing.init-d.script-customization.when-running deployment.installing.nix-services.script-customization.when-running.conf-file=deployment.installing.init-d.script-customization.when-running.conf-file + +# gh-35856 +features.testing.testcontainers.at-development-time=features.testcontainers.at-development-time +features.testing.testcontainers.at-development-time.dynamic-properties=features.testcontainers.at-development-time.dynamic-properties +features.testing.testcontainers.at-development-time.importing-container-declarations=features.testcontainers.at-development-time.importing-container-declarations +features.testing.testcontainers.at-development-time.devtools=features.testcontainers.at-development-time.devtools diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features.adoc index 5ef2be1174bd..55d96c714ec8 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features.adoc @@ -30,6 +30,8 @@ include::features/testing.adoc[] include::features/docker-compose.adoc[] +include::features/testcontainers.adoc[] + include::features/developing-auto-configuration.adoc[] include::features/kotlin.adoc[] diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testcontainers.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testcontainers.adoc new file mode 100644 index 000000000000..95b1eb9fd1a7 --- /dev/null +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/features/testcontainers.adoc @@ -0,0 +1,93 @@ +[[features.testcontainers]] +== Testcontainers Support +As well as <>, it's also possible to use them at development time. +The next sections will provide more details about that. + + + +[[features.testcontainers.at-development-time]] +=== Using Testcontainers at Development Time +This approach allows developers to quickly start containers for the services that the application depends on, removing the need to manually provision things like database servers. +Using Testcontainers in this way provides functionality similar to Docker Compose, except that your container configuration is in Java rather than YAML. + +To use Testcontainers at development time you need to launch your application using your "`test`" classpath rather than "`main`". +This will allow you to access all declared test dependencies and give you a natural place to write your test configuration. + +To create a test launchable version of your application you should create an "`Application`" class in the `src/test` directory. +For example, if your main application is in `src/main/java/com/example/MyApplication.java`, you should create `src/test/java/com/example/TestMyApplication.java` + +The `TestMyApplication` class can use the `SpringApplication.from(...)` method to launch the real application: + +include::code:launch/TestMyApplication[] + +You'll also need to define the `Container` instances that you want to start along with your application. +To do this, you need to make sure that the `spring-boot-testcontainers` module has been added as a `test` dependency. +Once that has been done, you can create a `@TestConfiguration` class that declares `@Bean` methods for the containers you want to start. + +You can also annotate your `@Bean` methods with `@ServiceConnection` in order to create `ConnectionDetails` beans. +See <> section for details of the supported technologies. + +A typical Testcontainers configuration would look like this: + +include::code:test/MyContainersConfiguration[] + +NOTE: The lifecycle of `Container` beans is automatically managed by Spring Boot. +Containers will be started and stopped automatically. + +TIP: You can use the configprop:spring.testcontainers.beans.startup[] property to change how containers are started. +By default `sequential` startup is used, but you may also choose `parallel` if you wish to start multiple containers in parallel. + +Once you have defined your test configuration, you can use the `with(...)` method to attach it to your test launcher: + +include::code:test/TestMyApplication[] + +You can now launch `TestMyApplication` as you would any regular Java `main` method application to start your application and the containers that it needs to run. + +TIP: You can use the Maven goal `spring-boot:test-run` or the Gradle task `bootTestRun` to do this from the command line. + + + +[[features.testcontainers.at-development-time.dynamic-properties]] +==== Contributing Dynamic Properties at Development Time +If you want to contribute dynamic properties at development time from your `Container` `@Bean` methods, you can do so by injecting a `DynamicPropertyRegistry`. +This works in a similar way to the <> that you can use in your tests. +It allows you to add properties that will become available once your container has started. + +A typical configuration would look like this: + +include::code:MyContainersConfiguration[] + +NOTE: Using a `@ServiceConnection` is recommended whenever possible, however, dynamic properties can be a useful fallback for technologies that don't yet have `@ServiceConnection` support. + + + +[[features.testcontainers.at-development-time.importing-container-declarations]] +==== Importing Testcontainer Declaration Classes +A common pattern when using Testcontainers is to declare `Container` instances as static fields. +Often these fields are defined directly on the test class. +They can also be declared on a parent class or on an interface that the test implements. + +For example, the following `MyContainers` interface declares `mongo` and `neo4j` containers: + +include::code:MyContainers[] + +If you already have containers defined in this way, or you just prefer this style, you can import these declaration classes rather than defining you containers as `@Bean` methods. +To do so, add the `@ImportTestcontainers` annotation to your test configuration class: + +include::code:MyContainersConfiguration[] + +TIP: You can use the `@ServiceConnection` annotation on `Container` fields to establish service connections. +You can also add <> to your declaration class. + + + +[[features.testcontainers.at-development-time.devtools]] +==== Using DevTools with Testcontainers at Development Time +When using devtools, you can annotate beans and bean methods with `@RestartScope`. +Such beans won't be recreated when the devtools restart the application. +This is especially useful for Testcontainer `Container` beans, as they keep their state despite the application restart. + +include::code:MyContainersConfiguration[] + +WARNING: If you're using Gradle and want to use this feature, you need to change the configuration of the `spring-boot-devtools` dependency from `developmentOnly` to `testImplementation`. +With the default scope of `developmentOnly`, the `bootTestRun` task will not pick up changes in your code, as the devtools are not active. 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 5a957f187781..32cebc48fbf9 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 @@ -1055,96 +1055,6 @@ The above configuration allows Neo4j-related beans in the application to communi -[[features.testing.testcontainers.at-development-time]] -==== Using Testcontainers at Development Time -As well as using Testcontainers for integration testing, it's also possible to use them at development time. -This approach allows developers to quickly start containers for the services that the application depends on, removing the need to manually provision things like database servers. -Using Testcontainers in this way provides functionality similar to Docker Compose, except that your container configuration is in Java rather than YAML. - -To use Testcontainers at development time you need to launch your application using your "`test`" classpath rather than "`main`". -This will allow you to access all declared test dependencies and give you a natural place to write your test configuration. - -To create a test launchable version of your application you should create an "`Application`" class in the `src/test` directory. -For example, if your main application is in `src/main/java/com/example/MyApplication.java`, you should create `src/test/java/com/example/TestMyApplication.java` - -The `TestMyApplication` class can use the `SpringApplication.from(...)` method to launch the real application: - -include::code:launch/TestMyApplication[] - -You'll also need to define the `Container` instances that you want to start along with your application. -To do this, you need to make sure that the `spring-boot-testcontainers` module has been added as a `test` dependency. -Once that has been done, you can create a `@TestConfiguration` class that declares `@Bean` methods for the containers you want to start. - -You can also annotate your `@Bean` methods with `@ServiceConnection` in order to create `ConnectionDetails` beans. -See <> section above for details of the supported technologies. - -A typical Testcontainers configuration would look like this: - -include::code:test/MyContainersConfiguration[] - -NOTE: The lifecycle of `Container` beans is automatically managed by Spring Boot. -Containers will be started and stopped automatically. - -TIP: You can use the configprop:spring.testcontainers.beans.startup[] property to change how containers are started. -By default `sequential` startup is used, but you may also choose `parallel` if you wish to start multiple containers in parallel. - -Once you have defined your test configuration, you can use the `with(...)` method to attach it to your test launcher: - -include::code:test/TestMyApplication[] - -You can now launch `TestMyApplication` as you would any regular Java `main` method application to start your application and the containers that it needs to run. - -TIP: You can use the Maven goal `spring-boot:test-run` or the Gradle task `bootTestRun` to do this from the command line. - - - -[[features.testing.testcontainers.at-development-time.dynamic-properties]] -===== Contributing Dynamic Properties at Development Time -If you want to contribute dynamic properties at development time from your `Container` `@Bean` methods, you can do so by injecting a `DynamicPropertyRegistry`. -This works in a similar way to the <> that you can use in your tests. -It allows you to add properties that will become available once your container has started. - -A typical configuration would look like this: - -include::code:MyContainersConfiguration[] - -NOTE: Using a `@ServiceConnection` is recommended whenever possible, however, dynamic properties can be a useful fallback for technologies that don't yet have `@ServiceConnection` support. - - - -[[features.testing.testcontainers.at-development-time.importing-container-declarations]] -===== Importing Testcontainer Declaration Classes -A common pattern when using Testcontainers is to declare `Container` instances as static fields. -Often these fields are defined directly on the test class. -They can also be declared on a parent class or on an interface that the test implements. - -For example, the following `MyContainers` interface declares `mongo` and `neo4j` containers: - -include::code:MyContainers[] - -If you already have containers defined in this way, or you just prefer this style, you can import these declaration classes rather than defining you containers as `@Bean` methods. -To do so, add the `@ImportTestcontainers` annotation to your test configuration class: - -include::code:MyContainersConfiguration[] - -TIP: You can use the `@ServiceConnection` annotation on `Container` fields to establish service connections. -You can also add <> to your declaration class. - - - -[[features.testing.testcontainers.at-development-time.devtools]] -===== Using DevTools with Testcontainers at Development Time -When using devtools, you can annotate beans and bean methods with `@RestartScope`. -Such beans won't be recreated when the devtools restart the application. -This is especially useful for Testcontainer `Container` beans, as they keep their state despite the application restart. - -include::code:MyContainersConfiguration[] - -WARNING: If you're using Gradle and want to use this feature, you need to change the configuration of the `spring-boot-devtools` dependency from `developmentOnly` to `testAndDevelopmentOnly`. -With the default scope of `developmentOnly`, the `bootTestRun` task will not pick up changes in your code, as the devtools are not active. - - - [[features.testing.utilities]] === Test Utilities A few test utility classes that are generally useful when testing your application are packaged as part of `spring-boot`. diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/devtools/MyContainersConfiguration.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/devtools/MyContainersConfiguration.java similarity index 92% rename from spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/devtools/MyContainersConfiguration.java rename to spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/devtools/MyContainersConfiguration.java index 04eb33a8f7a5..541cdae30a86 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/devtools/MyContainersConfiguration.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/devtools/MyContainersConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.devtools; +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.devtools; import org.testcontainers.containers.MongoDBContainer; diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/dynamicproperties/MyContainersConfiguration.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/dynamicproperties/MyContainersConfiguration.java similarity index 92% rename from spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/dynamicproperties/MyContainersConfiguration.java rename to spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/dynamicproperties/MyContainersConfiguration.java index fb839227f026..143a28f6a843 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/dynamicproperties/MyContainersConfiguration.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/dynamicproperties/MyContainersConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.dynamicproperties; +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.dynamicproperties; import org.testcontainers.containers.MongoDBContainer; diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainers.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainers.java similarity index 89% rename from spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainers.java rename to spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainers.java index 8ae02897c37a..3933efecf98b 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainers.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainers.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.importingcontainerdeclarations; +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.importingcontainerdeclarations; import org.testcontainers.containers.MongoDBContainer; import org.testcontainers.containers.Neo4jContainer; diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.java similarity index 88% rename from spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.java rename to spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.java index 00b4078610a9..1e6efc47b1b2 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.importingcontainerdeclarations; +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.importingcontainerdeclarations; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.testcontainers.context.ImportTestcontainers; diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/MyApplication.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/launch/MyApplication.java similarity index 88% rename from spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/MyApplication.java rename to spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/launch/MyApplication.java index e8339f1dae02..1c44bb1a0270 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/MyApplication.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/launch/MyApplication.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.test; +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.launch; public class MyApplication { diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/launch/TestMyApplication.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/launch/TestMyApplication.java similarity index 89% rename from spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/launch/TestMyApplication.java rename to spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/launch/TestMyApplication.java index 782d5e6754b3..54ca0ebee36e 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/launch/TestMyApplication.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/launch/TestMyApplication.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.launch; +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.launch; import org.springframework.boot.SpringApplication; diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/launch/MyApplication.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/MyApplication.java similarity index 87% rename from spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/launch/MyApplication.java rename to spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/MyApplication.java index f93a2601abbc..08c049ab5044 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/launch/MyApplication.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/MyApplication.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.launch; +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.test; public class MyApplication { diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/MyContainersConfiguration.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/MyContainersConfiguration.java similarity index 92% rename from spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/MyContainersConfiguration.java rename to spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/MyContainersConfiguration.java index df8852b44762..11a9e78fb474 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/MyContainersConfiguration.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/MyContainersConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.test; +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.test; import org.testcontainers.containers.Neo4jContainer; diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/TestMyApplication.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/TestMyApplication.java similarity index 90% rename from spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/TestMyApplication.java rename to spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/TestMyApplication.java index 9253edcdcb56..199e4cf98e82 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/TestMyApplication.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/TestMyApplication.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.test; +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.test; import org.springframework.boot.SpringApplication; diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/devtools/MyContainersConfiguration.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/devtools/MyContainersConfiguration.kt similarity index 92% rename from spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/devtools/MyContainersConfiguration.kt rename to spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/devtools/MyContainersConfiguration.kt index 1576ffc41301..6e6a6b0f45f2 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/devtools/MyContainersConfiguration.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/devtools/MyContainersConfiguration.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.devtools +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.devtools import org.springframework.boot.devtools.restart.RestartScope import org.springframework.boot.test.context.TestConfiguration diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/dynamicproperties/MyContainersConfiguration.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/dynamicproperties/MyContainersConfiguration.kt similarity index 92% rename from spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/dynamicproperties/MyContainersConfiguration.kt rename to spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/dynamicproperties/MyContainersConfiguration.kt index c992efeaf96b..b77436639cf5 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/dynamicproperties/MyContainersConfiguration.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/dynamicproperties/MyContainersConfiguration.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.dynamicproperties +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.dynamicproperties import org.springframework.boot.test.context.TestConfiguration import org.springframework.context.annotation.Bean; @@ -32,4 +32,4 @@ class MyContainersConfiguration { return container } -} \ No newline at end of file +} diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.kt similarity index 88% rename from spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.kt rename to spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.kt index 89c5b8ecc29c..0d5c7a9c63da 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/importingcontainerdeclarations/MyContainersConfiguration.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.importingcontainerdeclarations +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.importingcontainerdeclarations import org.springframework.boot.test.context.TestConfiguration import org.springframework.boot.testcontainers.context.ImportTestcontainers @@ -23,4 +23,4 @@ import org.springframework.boot.testcontainers.context.ImportTestcontainers @ImportTestcontainers(MyContainers::class) class MyContainersConfiguration { -} \ No newline at end of file +} diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/launch/MyApplication.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/launch/MyApplication.kt similarity index 90% rename from spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/launch/MyApplication.kt rename to spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/launch/MyApplication.kt index 604343d60eac..425368d5604a 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/launch/MyApplication.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/launch/MyApplication.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.launch +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.launch import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.docs.features.springapplication.MyApplication diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/launch/TestMyApplication.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/launch/TestMyApplication.kt similarity index 88% rename from spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/launch/TestMyApplication.kt rename to spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/launch/TestMyApplication.kt index 3aac403b3060..40d1e091e166 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/launch/TestMyApplication.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/launch/TestMyApplication.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.launch +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.launch import org.springframework.boot.fromApplication diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/MyApplication.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/MyApplication.kt similarity index 90% rename from spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/MyApplication.kt rename to spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/MyApplication.kt index 6207bfb2ba32..05405fb0063d 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/MyApplication.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/MyApplication.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.test +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.test import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.docs.features.springapplication.MyApplication diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/MyContainersConfiguration.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/MyContainersConfiguration.kt similarity index 87% rename from spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/MyContainersConfiguration.kt rename to spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/MyContainersConfiguration.kt index 26a3e420ec7b..b5d8f291b57c 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/MyContainersConfiguration.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/MyContainersConfiguration.kt @@ -14,13 +14,12 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.test - -import org.testcontainers.containers.Neo4jContainer +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.test import org.springframework.boot.test.context.TestConfiguration import org.springframework.boot.testcontainers.service.connection.ServiceConnection -import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Bean +import org.testcontainers.containers.Neo4jContainer @TestConfiguration(proxyBeanMethods = false) class MyContainersConfiguration { @@ -31,4 +30,4 @@ class MyContainersConfiguration { return Neo4jContainer("neo4j:5") } -} \ No newline at end of file +} diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/TestMyApplication.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/TestMyApplication.kt similarity index 89% rename from spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/TestMyApplication.kt rename to spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/TestMyApplication.kt index 8918374d612e..1f397fba6e4b 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testing/testcontainers/atdevelopmenttime/test/TestMyApplication.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/features/testcontainers/atdevelopmenttime/test/TestMyApplication.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.docs.features.testing.testcontainers.atdevelopmenttime.test +package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.test import org.springframework.boot.fromApplication import org.springframework.boot.with