Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid requiring it lambda parameter in Kotlin bean DSL [SPR-15815] #20370

Closed
spring-projects-issues opened this issue Jul 25, 2017 · 0 comments
Closed
Assignees
Labels
type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jul 25, 2017

Sébastien Deleuze opened SPR-15815 and commented

Based on a proposal by Joseph Taylor from Pivotal Labs London, it is possible to improve Kotlin bean DSL by avoid requiring it lambda parameter using function literals with receiver.

Spring Framework 5 RC3 syntax:

beans {
	bean<Foo>()
	bean<Bar>("bar")
	bean { FooFoo(it.env["name"]) }
	environment({it.activeProfiles.contains("baz")}) {
		bean { Baz(it.ref()) }
		bean { Baz(it.ref("bar")) }
	}
}

Spring Framework 5 RC4+ syntax:

beans {
	bean<Foo>()
	bean<Bar>("bar")
	bean { FooFoo(env["name"]) }
	environment({activeProfiles.contains("baz")}) {
		bean { Baz(ref()) }
		bean { Baz(ref("bar")) }
	}
}

Affects: 5.0 RC3

Referenced from: commits 29c112c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants