@ -364,9 +364,9 @@ TIP: You can use the Maven goal `spring-boot:test-run` or the Gradle task `bootT
@@ -364,9 +364,9 @@ TIP: You can use the Maven goal `spring-boot:test-run` or the Gradle task `bootT
==== 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 xref:testing/testcontainers.adoc#testing.testcontainers.dynamic-properties[`@DynamicPropertySource` annotation] that you can use in your tests.
It allows you to add properties that will become available once your container has started.
If you want to contribute dynamic properties at development time from your `Container` `@Bean` methods, define an additional `DynamicPropertyRegistrar` bean.
The registrar should be defined using a `@Bean` method that injects the container from which the properties will be sourced as a parameter.
This arrangement ensures that container has been started before the properties are used.
Assert.notNull(valueSupplier,"'valueSupplier' must not be null");
valueSuppliers.put(name,valueSupplier);
};
@ -117,7 +130,12 @@ public class TestcontainersPropertySource extends MapPropertySource {
@@ -117,7 +130,12 @@ public class TestcontainersPropertySource extends MapPropertySource {
@ -157,4 +175,34 @@ public class TestcontainersPropertySource extends MapPropertySource {
@@ -157,4 +175,34 @@ public class TestcontainersPropertySource extends MapPropertySource {
@ -164,8 +163,6 @@ public abstract class ContainerConnectionDetailsFactory<C extends Container<?>,
@@ -164,8 +163,6 @@ public abstract class ContainerConnectionDetailsFactory<C extends Container<?>,
@ -190,7 +187,9 @@ public abstract class ContainerConnectionDetailsFactory<C extends Container<?>,
@@ -190,7 +187,9 @@ public abstract class ContainerConnectionDetailsFactory<C extends Container<?>,
protectedfinalCgetContainer(){
Assert.state(this.container!=null,
"Container cannot be obtained before the connection details bean has been initialized");
@ -200,8 +199,8 @@ public abstract class ContainerConnectionDetailsFactory<C extends Container<?>,
@@ -200,8 +199,8 @@ public abstract class ContainerConnectionDetailsFactory<C extends Container<?>,