DropWizard + Kotlin = Project Kronslott

David Eriksson
2 min readMar 3, 2018

--

Kronslott on the island Kotlin. Source: https://commons.wikimedia.org/wiki/File:Kronslott.jpg

If you didn’t already know, you should switch from Java to Kotlin. It’s the perfect middle road between the verbose and clunky Java, and the too-clever-for-its-own-good Scala.

I already have been using Kotlin in the Android application for my soon-to-be-released mobile outdoor adventure Towers for some months but it’s only recently that I had the great pleasure to try out some Kotlin on the server side with DropWizard and Dagger 2.

My plan is to extract some of the application as DropWizard bundles and make them available as MIT licensed source code on GitHub and binaries at Maven Central. I also plan to create an example application that shows how it all fits together.

All of these things will be called Project Kronslott, from the name of the fortification built in 1704 on the island of Kotlin.

In my project I tried out https://github.com/MicroUtils/kotlin-logging:

Lightweight logging framework for Kotlin. A convenient and performant logging library wrapping slf4j with Kotlin extensions

So far it works fine with DropWizard and why shouldn’t it?

Dropwizard uses Logback for its logging backend. It provides an slf4j implementation, and even routes all java.util.logging, Log4j, and Apache Commons Logging usage through Logback.

In my Kotlin classes I simply write:

As usual with Kotlin, this was much nicer than the equivalent Java code:

PS. Do you need a seasoned coding architect? I’m soon available for remote freelance gigs.

--

--