Prefer DynamicPropertyRegistar to DynamicPropertyRegistry
Closes gh-41996
This commit is contained in:
@@ -364,9 +364,9 @@ TIP: You can use the Maven goal `spring-boot:test-run` or the Gradle task `bootT
|
||||
[[features.dev-services.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 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.
|
||||
|
||||
A typical configuration would look like this:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user