Dropwizard REST API in Docker Container
Introduction to Dropwizard (alternative to Spring Boot). You’ll learn core concepts and how to implement a simple web service and deploy it with Docker
Dropwizard is a lightweight and high-performance open-source Java framework/library. As the official home page describes, “Dropwizard straddles the line between being a library and a framework”.
Dropwizard applications are built as fat JARs with Jetty as the embedded web server. It’s different from Spring Boot which uses Tomcat as the embedded web server.
It uses Jersey for implementing the RESTful services and Jackson for handling the models mapping to and from JSON.
Apart from Jetty, Jersey and Jackson, other libraries are included in a minimal setup. They are Logback and sfl4j, Hibernate validator, JDBI, Apache HttpClient and others.
Dropwizard doesn’t support dependency injection by default, but it can be easily added. I’ll explore it in more detail in another article.
Let’s look at how to implement a “hello world” kind of application using Dropwizard. I used IntelliJ IDEA, OpenJDK 19, Dropwizard 2.1.2 and Docker.