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-issuemaster opened this issue Jul 25, 2017 · 0 comments
Closed
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.