diff --git a/framework-docs/modules/ROOT/pages/testing/testcontext-framework/ctx-management/dynamic-property-sources.adoc b/framework-docs/modules/ROOT/pages/testing/testcontext-framework/ctx-management/dynamic-property-sources.adoc index ca26bfa32d..1eb927a418 100644 --- a/framework-docs/modules/ROOT/pages/testing/testcontext-framework/ctx-management/dynamic-property-sources.adoc +++ b/framework-docs/modules/ROOT/pages/testing/testcontext-framework/ctx-management/dynamic-property-sources.adoc @@ -162,7 +162,7 @@ Java:: } @Bean - DynamicPropertyRegistrar apiServerProperties(ApiServer apiServer) { + DynamicPropertyRegistrar apiPropertiesRegistrar(ApiServer apiServer) { return registry -> registry.add("api.url", apiServer::getUrl); } } @@ -181,7 +181,7 @@ Kotlin:: } @Bean - fun apiServerProperties(apiServer: ApiServer): DynamicPropertyRegistrar { + fun apiPropertiesRegistrar(apiServer: ApiServer): DynamicPropertyRegistrar { return registry -> registry.add("api.url", apiServer::getUrl) } } diff --git a/spring-test/src/main/java/org/springframework/test/context/DynamicPropertyRegistrar.java b/spring-test/src/main/java/org/springframework/test/context/DynamicPropertyRegistrar.java index e30fe64805..cbdc84c26a 100644 --- a/spring-test/src/main/java/org/springframework/test/context/DynamicPropertyRegistrar.java +++ b/spring-test/src/main/java/org/springframework/test/context/DynamicPropertyRegistrar.java @@ -67,7 +67,7 @@ package org.springframework.test.context; * } * * @Bean - * DynamicPropertyRegistrar apiServerProperties(ApiServer apiServer) { + * DynamicPropertyRegistrar apiPropertiesRegistrar(ApiServer apiServer) { * return registry -> registry.add("api.url", apiServer::getUrl); * } * @@ -82,6 +82,9 @@ package org.springframework.test.context; @FunctionalInterface public interface DynamicPropertyRegistrar { + /** + * Register dynamic properties in the supplied registry. + */ void accept(DynamicPropertyRegistry registry); } diff --git a/spring-test/src/test/java/org/springframework/test/context/DynamicPropertyRegistrarIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/DynamicPropertyRegistrarIntegrationTests.java index 477c4ab026..cd29d2c198 100644 --- a/spring-test/src/test/java/org/springframework/test/context/DynamicPropertyRegistrarIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/DynamicPropertyRegistrarIntegrationTests.java @@ -117,12 +117,12 @@ class DynamicPropertyRegistrarIntegrationTests { // context which further ensures that the dynamic "api.url" property is // available to all standard singleton beans. @Bean - DynamicPropertyRegistrar apiServerProperties1(ApiServer apiServer) { + DynamicPropertyRegistrar apiPropertiesRegistrar1(ApiServer apiServer) { return registry -> registry.add(API_URL_1, () -> apiServer.getUrl() + "/1"); } @Bean - DynamicPropertyRegistrar apiServerProperties2(ApiServer apiServer) { + DynamicPropertyRegistrar apiPropertiesRegistrar2(ApiServer apiServer) { return registry -> registry.add(API_URL_2, () -> apiServer.getUrl() + "/2"); } diff --git a/spring-test/src/test/java/org/springframework/test/context/DynamicPropertySourceIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/DynamicPropertySourceIntegrationTests.java index ba6d675e31..46bba1db14 100644 --- a/spring-test/src/test/java/org/springframework/test/context/DynamicPropertySourceIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/DynamicPropertySourceIntegrationTests.java @@ -112,7 +112,7 @@ class DynamicPropertySourceIntegrationTests { static class Config { @Bean - DynamicPropertyRegistrar magicWordProperties() { + DynamicPropertyRegistrar magicPropertiesRegistrar() { return registry -> registry.add(MAGIC_WORD, () -> "enigma"); }