The Java alternative is gaining more support in the form of frameworks, including established tools like Spring Framework and Vert.x
Kotlin, the statically typed alterative Java language for JVM and Android development, is showing signs of making it into the big leagues, getting support in development frameworks.
For example, the Spring Framework now supports Kotlin. And there are new frameworks such as Javalin and Ktor that support Kotlin.
- Kotlin frameworks: Support in the Spring Framework
- Kotlin frameworks: Support in the Vert.x framework
- Kotlin frameworks: Spark Framework for web apps
- Kotlin frameworks: Ktor framework for connected apps
- Kotlin frameworks: Javalin REST API library for web apps
Kotlin frameworks: Support in the Spring Framework
Best known as a venerable Java framework featuring dependency injection, Pivotal’s Spring Framework gained Kotlin support in the Spring 5.0 version released this year. Spring 5.0 supports Kotlin extensions, offering an alternative to utility classes and Kotlin-specific class hierarchies, as well as adding Kotlin features to Spring itself.
A routing domain-specific language (DSL) for Kotlin in Spring 5.0 lets developers use the Spring Functional Web API to access Spring’s functional web framework.
You can use Kotln to write annotation-based applications for the companion Spring Boot technology for building production-ready, standalone Spring applications.
Where to download the Spring Framework
You can download the Spring Framework from repo.spring.io or Maven Central.
Kotlin frameworks: Support in the Vert.x framework
Version 3.5 of the Eclipse Foundation’s Vert.x JVM framework supports Kotlin coroutines, for performing asynchronous events and event processing. Geared to enterprise and web development, Vert.x is event-driven and nonblocking, so applications can handle concurrency with few threads and at scale.
Where to download Vert.x
You can download Vert.x from the Vert.x project website or from Bintray.
Kotlin frameworks: Spark Framework for web apps
A web framework for Java development, Spark has added a Kotlin DSL, for building Kotlin and Java 8 applications. Spark offers a venue for Kotlin and Java developers to build expressive web apps with little boilerplate code via a declarative syntax.
Not to be confused with the Apache Spark project for data processing, Spark can be used for building REST APIs but also supports template engines. For developing microservices, Spark can serve JSON in fewer than ten lines of code.
Where to download the Spark framework
You can download Spark from Maven Central or GitHub.
Kotlin frameworks: Ktor framework for connected apps
Developed by Kotlin creator JetBrains, the new Ktor framework for JVM scenarios embraces Kotlin’s strongly typed nature and offers strongly typed endpoints and the ability to exchange data with classes shared across platforms. It provides a multiplatform application framework for the development of connected applications.
Ktor’s pipeline capabilities, for processing HTTP requests, and APIs use Kotlin coroutines, offering an asynchronous programming model. Ktor APIs are primarily function calls with lambdas. Ktor’s Kotlin DSL lets code appear as declarative.
Where to download Ktor
You can download Ktor from JetBrains’s download page for Ktor.
Kotlin frameworks: Javalin REST API library for web apps
Having just reached its Version 1.0 stable release in early November, Javalin is a lightweight web framework for Kotlin and Java, taking inspiration from the Spark and Koa web frameworks. Javalin is not a full framework but a REST API library. It is based in Kotlin, although a few functional interfaces were written in Java.
There is no concept of model-view-controller (MVC) in Javalin; instead, it supports template engines, websockets, and static file-serving. Javalin also has an embedded Jetty server as well as template and markdown rendering.
Where to download the Javalin REST API library
You can get Javalin from the Javalin project’s download page.