Add a [] Kotlin extension for PropertyResolver#getRequiredProperty

This commit is contained in:
Sebastien Deleuze
2017-07-18 16:42:32 +02:00
parent f72e0daa54
commit e2fd04dff3
3 changed files with 75 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException
import org.springframework.beans.factory.getBean
import org.springframework.context.support.BeanDefinitionDsl.*
import org.springframework.core.env.SimpleCommandLinePropertySource
import org.springframework.core.env.get
class BeanDefinitionDslTests {
@@ -76,7 +77,7 @@ class BeanDefinitionDslTests {
val beans = beans {
bean<Foo>()
bean<Bar>("bar")
bean { FooFoo(it.env.getProperty("name")) }
bean { FooFoo(it.env["name"]) }
environment({it.activeProfiles.contains("baz")}) {
bean { Baz(it.ref()) }
bean { Baz(it.ref("bar")) }