Introduction to Dropwizard framework

Posted By : Anil Kumar Maurya | 30-Apr-2019

Dropwizard plays a very important role in a microservice architecture. A framework that is used for building RESTful web services. We can say a set of tools and frameworks for building RESTful web services. Dropwizard is a kind of tool which contains all the dependencies bundled into a single package or can be added as a separate module.

 

By not using Dropwizard, we will have to collect all dependencies yourself and this can lead to class loading issues due to a version mismatch between various Java libraries. This problem can be solved by using Dropwizard. It pulls stable, mature libraries into a simple, light-weight package that lets us focus on getting things done.

 

It permits developers quick project bootstrapping. This causes you to bundle your applications to be effectively deployable in a production environment as standalone services.

 

Here’s a list of some of the libraries that Dropwizard uses.

1. Jersey — the reference implementation of JAX-RS, the API for RESTful web services in the Java platform
2. Jackson — library for processing JSON data
3. Jetty — HTTP server and Java Servlet container
4. Metrics — library for capturing JVM- and application-level metrics for monitoring
5. Guava — utility library
6. Logback — logging library

 


Maven Configuration

Maven is officially supported by Dropwizard. You can also use other build tools. The first step in creating your Dropwizard application is defining the code dependencies. Add the following entry in your Maven’s pom.xml file:

 

<dependencies>
  <dependency>
  <groupId>io.dropwizard</groupId>
  <artifactId>dropwizard-core</artifactId>
  <version>${dropwizard.version}</version>
  </dependency>
</dependencies>

 

We can add the Dropwizard.version as below:

 

<properties>
  <dropwizard.version>1.1.0</dropwizard.version>
</properties>

 

We have done writing the Maven configuration. The above maven configuration will download all the required dependencies to our project.

 

Pros: Dropwizard offers easily bootstrap by joining best-of-breed Java libraries and some decent setup together, additionally demonstrates the amazing outcome on the production environment.

Cons: Since it does most of the job for us, we lose some freedom which actually differs you from the .NET developer.

About Author

Author Image
Anil Kumar Maurya

Anil is an experienced Lead with core knowledge of Java, Spring, and SQL. He has good working experience in banking, finance and trading domain.

Request for Proposal

Name is required

Comment is required

Sending message..