Rapid REST API development with Dropwizard

Focus on your business problem, NOT the plumbing work!

RAPID REST API Development with Dropwizard
Learn on Udemy Today!

As a developer, you all know about REST API. There are tons of frameworks available in Java to develop RESTful webservices. Jersey, RESTeasy, Spring are some of the popular frameworks available in the market. Have you ever felt your REST API development process in a straight forward way? Mostly NOT!

But one framework which I evaluated recently has most of the plus points and it allowed me to focus on my business problem instead of the plumbing work to prepare the infrastructure. This is none other than “Dropwizard

This tiny framework came very late in the market when compared to most of the other frameworks and attract the developer’s attention is a shorter time. In 2012 it was mentioned in the Thoughtworks technology radar as “TRIAL”. It jumped to “ADAPT” with-in 2 years gap (Refer https://www.thoughtworks.com/radar/languages-and-frameworks/dropwizard)

Why I liked Dropwizard?

  • Easy development setup
  • In-built metrics infrastructure
  • Health check
  • Embedded HTTP Server

Beauty of Dropwizard

Dropwizard is like a developer BOX. It contains all the good parts which are required for easy development. For example it contains the following well known API / framework to ease our development.

  • REST API – Jersey
  • Logging – Logback
  • Deployment – Jetty
  • Metrics – Metrics library
  • Health check – In built
  • Collection Util – Google Guava
  • JSON Parsing – Jackson library
  • and many more…

Ok we have seen some of the good parts of Dropwizard framework. In the next section we will quickly see the code for developing a REST API. First we have to create a Maven based project and add the following changes in your pom.xml

Instance of Application is the main entry point for any Dropwizard application. Now our resource file has to be registered with the application like below,

Our first REST API development is done. Finally compile and run the application using the following commands,

Wouldn’t that be amazing? Now you can access your REST API using any client! Dropwizard is the right candidate for RAPID REST API development with clean and crisp!

I hope you have enjoyed this article. Let me know if you have any comments or feedback. Please share this article with your friends…

Previous articleRESTful Java metering by Dropwizard Metrics
Next articlePowerful tactic to use exception mapper in Dropwizard
Thamizharasu is a Java developer living in India. He is writing about Java programming, RESTful web services and frameworks. He also loves working with Web API, Elastic search and Firebase. Currently he is a Madras JUG lead and you can follow him on Twitter @zarub2k