Browse Source

Polishing

See gh-18353
pull/34552/head
Sébastien Deleuze 10 months ago
parent
commit
fda9b9a696
  1. 10
      framework-docs/modules/ROOT/pages/core/beans/java/programmatic-bean-registration.adoc
  2. 2
      spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanRegistrarDsl.kt
  3. 2
      spring-context/src/test/kotlin/org/springframework/context/annotation/BeanRegistrarDslConfigurationTests.kt

10
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 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`] provided via the {spring-framework-api}/beans/factory/BeanRegistrar.html[`BeanRegistrar`]
interface that can be implemented to register beans programmatically in a concise and interface that can be implemented to register beans programmatically in a flexible and
flexible way. For example, it allows custom registration through an `if` expression, a efficient way.
`for` loop, etc.
Those bean registrar implementations are typically imported with an `@Import` annotation Those bean registrar implementations are typically imported with an `@Import` annotation
on `@Configuration` classes. 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 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 {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] [tabs]
====== ======
@ -70,7 +70,7 @@ Kotlin::
---- ----
class MyBeanRegistrar : BeanRegistrarDsl({ class MyBeanRegistrar : BeanRegistrarDsl({
registerBean<Foo>() registerBean<Foo>()
registerBean<Bar>( registerBean(
name = "bar", name = "bar",
prototype = true, prototype = true,
lazyInit = true, lazyInit = true,

2
spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanRegistrarDsl.kt

@ -37,7 +37,7 @@ import org.springframework.core.env.Environment
* ``` * ```
* class MyBeanRegistrar : BeanRegistrarDsl({ * class MyBeanRegistrar : BeanRegistrarDsl({
* registerBean<Foo>() * registerBean<Foo>()
* registerBean<Bar>( * registerBean(
* name = "bar", * name = "bar",
* prototype = true, * prototype = true,
* lazyInit = true, * lazyInit = true,

2
spring-context/src/test/kotlin/org/springframework/context/annotation/BeanRegistrarDslConfigurationTests.kt

@ -74,7 +74,7 @@ class BeanRegistrarDslConfigurationTests {
private class SampleBeanRegistrar : BeanRegistrarDsl({ private class SampleBeanRegistrar : BeanRegistrarDsl({
registerBean<Foo>() registerBean<Foo>()
registerBean<Bar>( registerBean(
name = "bar", name = "bar",
prototype = true, prototype = true,
lazyInit = true, lazyInit = true,

Loading…
Cancel
Save