Kotlin Support in Spring Cloud Function

Engineering | Oleg Zhurakousky | September 11, 2018 | ...

Rarely we blog about a single feature, but given that this one was one of the most requested ones in Spring Cloud Function (relatively young project), we thought it may be appropriate, so here it is.

Initial support for Kotlin lambdas has been added to Spring Cloud Function. What it means is that Spring Cloud Function can now recognize Kotlin lambdas that effectively match to one of Java's Supplier, Function or Consumer and treat them as such.

That is:

open fun kotlinFunction(): (String) -> String {
    return  { it.toUpperCase() }

open fun kotlinConsumer(): (String) -> Unit {
    return  { println(it) }

open fun kotlinSupplier(): () -> String {
    return  { "Hello Kotlin" }

Check out the sample project here

That is pretty much it. The feature is available in the current snapshot and will be part of Spring Cloud Function 2.0.0.RELEASE. This means that enhancements and modifications are still ongoing so your feedback is quite important.

For more on Spring Cloud Function see the following:

https://spring.io/blog/2017/07/05/introducing-spring-cloud-function https://www.nurkiewicz.com/2018/04/sneak-peek-at-spring-cloud-function.html


Get ahead

VMware offers training and certification to turbo-charge your progress.

Learn more

Get support

Tanzu Spring Runtime offers support and binaries for OpenJDK™, Spring, and Apache Tomcat® in one simple subscription.

Learn more

Upcoming events

Check out all the upcoming events in the Spring community.

View all