Leverage non-default ctor support in Kotlin bean DSL

Since non-default constructors are now evaluated for autowiring,
there is no need anymore for setting autowiring mode or exposing
it in Kotlin bean DSL.

Issue: SPR-17292
This commit is contained in:
Sebastien Deleuze
2018-09-19 23:40:32 +02:00
parent b6b880ce27
commit 47d6e91227
2 changed files with 16 additions and 43 deletions

View File

@@ -143,6 +143,19 @@ class BeanDefinitionDslTests {
val barbar = context.getBean<BarBar>()
assertEquals(2, barbar.foos.size)
}
@Test // SPR-17292
fun `Declare beans leveraging constructor injection`() {
val beans = beans {
bean<Bar>()
bean<Baz>()
}
val context = GenericApplicationContext().apply {
beans.initialize(this)
refresh()
}
context.getBean<Baz>()
}
}