You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While shorter, this syntax is not declarative (verbs like register are used), require to choose and expose a specific ApplicationContext implementation which is not very common in Spring Boot applications for example and could be more easy to write and read.
My proposal is to provide a lightweight Kotlin DSL to allow an even more idiomatic way to register bean in Kotlin:
beans {
bean<Foo>()
bean { Bar(it.ref<Foo>()) }
}
This Kotlin functional bean registration DSL would return a Consumer<GenericApplicationContext> allowing to register beans on an existing application context like the one created by Boot (see also the related #18353 issue).
Sébastien Deleuze opened SPR-15755 and commented
As a follow-up of Spring Framework 5.0 bean registration Kotlin extensions, close to what we did for the Kotlin functional WebFlux DSL and similar to Groovy bean configuration DSL (but very different in term of implementation since here no internal XML-based application context is involved), this issue is about introducing a very lightweight Kotlin DSL for function bean registration.
Current Kotlin extensions in Spring Framework 5 RC2 allow to write this Java version
Like following in Kotlin:
While shorter, this syntax is not declarative (verbs like register are used), require to choose and expose a specific
ApplicationContext
implementation which is not very common in Spring Boot applications for example and could be more easy to write and read.My proposal is to provide a lightweight Kotlin DSL to allow an even more idiomatic way to register bean in Kotlin:
This Kotlin functional bean registration DSL would return a
Consumer<GenericApplicationContext>
allowing to register beans on an existing application context like the one created by Boot (see also the related #18353 issue).Referenced from: commits 1f01146, f72e0da
The text was updated successfully, but these errors were encountered: