From fda9b9a696fd0ce327a1d6f6cd33055982fad125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= <141109+sdeleuze@users.noreply.github.com> Date: Fri, 7 Mar 2025 09:00:06 +0100 Subject: [PATCH] Polishing See gh-18353 --- .../beans/java/programmatic-bean-registration.adoc | 10 +++++----- .../springframework/beans/factory/BeanRegistrarDsl.kt | 2 +- .../annotation/BeanRegistrarDslConfigurationTests.kt | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/framework-docs/modules/ROOT/pages/core/beans/java/programmatic-bean-registration.adoc b/framework-docs/modules/ROOT/pages/core/beans/java/programmatic-bean-registration.adoc index 98a5991acb8..f50c9402556 100644 --- a/framework-docs/modules/ROOT/pages/core/beans/java/programmatic-bean-registration.adoc +++ b/framework-docs/modules/ROOT/pages/core/beans/java/programmatic-bean-registration.adoc @@ -3,9 +3,8 @@ As of Spring Framework 7, a first-class support for programmatic bean registration is provided via the {spring-framework-api}/beans/factory/BeanRegistrar.html[`BeanRegistrar`] -interface that can be implemented to register beans programmatically in a concise and -flexible way. For example, it allows custom registration through an `if` expression, a -`for` loop, etc. +interface that can be implemented to register beans programmatically in a flexible and +efficient way. Those bean registrar implementations are typically imported with an `@Import` annotation on `@Configuration` classes. @@ -38,7 +37,8 @@ but also other variants) to conditionally import the related bean registrars. The bean registrar implementation uses {spring-framework-api}/beans/factory/BeanRegistry.html[`BeanRegistry`] and {spring-framework-api}/core/env/Environment.html[`Environment`] APIs to register beans programmatically in a concise -and flexible way. +and flexible way. For example, it allows custom registration through an `if` expression, a +`for` loop, etc. [tabs] ====== @@ -70,7 +70,7 @@ Kotlin:: ---- class MyBeanRegistrar : BeanRegistrarDsl({ registerBean() - registerBean( + registerBean( name = "bar", prototype = true, lazyInit = true, diff --git a/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanRegistrarDsl.kt b/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanRegistrarDsl.kt index 925e65981fa..799190319ee 100644 --- a/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanRegistrarDsl.kt +++ b/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanRegistrarDsl.kt @@ -37,7 +37,7 @@ import org.springframework.core.env.Environment * ``` * class MyBeanRegistrar : BeanRegistrarDsl({ * registerBean() - * registerBean( + * registerBean( * name = "bar", * prototype = true, * lazyInit = true, diff --git a/spring-context/src/test/kotlin/org/springframework/context/annotation/BeanRegistrarDslConfigurationTests.kt b/spring-context/src/test/kotlin/org/springframework/context/annotation/BeanRegistrarDslConfigurationTests.kt index 6f656b4eec2..6bbc0ee3ff3 100644 --- a/spring-context/src/test/kotlin/org/springframework/context/annotation/BeanRegistrarDslConfigurationTests.kt +++ b/spring-context/src/test/kotlin/org/springframework/context/annotation/BeanRegistrarDslConfigurationTests.kt @@ -74,7 +74,7 @@ class BeanRegistrarDslConfigurationTests { private class SampleBeanRegistrar : BeanRegistrarDsl({ registerBean() - registerBean( + registerBean( name = "bar", prototype = true, lazyInit = true,