I’m writing this walk-through to showcase you the best available Java RESTful micro frameworks. As “micro” is a relative word you may or may not consider these frameworks as such. If you have any objection please write it down in the comments section.
 
I will try to be as objective as possible, though I may slip from time to time so please don’t hold it against me.
 
Finally, the microframework of your choosing will solely depend on your needs. Hopefully, this list will help you decide and save some time.
 
 

Note: If this tutorial was helpful, need further clarification, something is not working or do you have a request for another Ionic post? Furthermore, if you don't like something about this blog, if something is bugging you, don't like how I'm doing stuff here, again leave me a comment below. I'm here to help you, I expect the same from you. Feel free to comment below, subscribe to my blog, mail me to dragan.gaic@gmail.com, or follow and mention me on twitter (@gajotres). Thanks and have a nice day!

PS. If you want my help, if possible (even if it takes you some time to do that), create a working example I can play with. Use Plunker for AngularJS based questions or jsFiddle for jQuery/jQuery Mobile based questions.


 

Introduction

Before we go any further, take a look at a list of my chosen eight, in alphabetical order:
 
  • Dropwizard
  • Light-rest-4j (also known as Light Java)
  • Ninja Web Framework
  • Play Framework
  • RESTEasy
  • Restlet
  • Spark Framework
  • Spring Boot
 
Before we proceed, if you are interested, here you can find speed benchmark of various Java micro frameworks. Some of these frameworks are benchmarked there. Introduction date: 2011
Rating: 4.5/5
 
Dropwizard provides stable, mature Java libraries assembled into a simple, light-weight package providing you with everything that lets you focus on getting things done.
 
It walks a fine line between a library and a framework, and it is intended to provide reliable implementations of everything your web application will need and require. Thanks to the built-in modularity, your application will remains small and lean, reducing development and maintenance time and possible burdens.
 
What makes me a little bit worried is that it uses existing frameworks glued together. Thankfully, none of these frameworks/libraries (Jetty, Jersey, Jackson, Logback, Hibernate, Metrics, JDBI, and Liquibase) suck on its own so you should give it a chance.
 
Similar to Spring Boot, it uses existing Jetty HTTP library embedding it directly into your project, this way external application server is not needed.
 

Links

 
 
Official Site GitHub Documentation
 
 

Pro

 
  • Perfect for a quick project building and bootstraping
  • Built around Modularity
  • Fast (at least according to the provided metrics
  • Comes with a Jetty for HTTP, Jersey for REST, and Jackson for JSON.
  • Other libraries also supported – you may or may not use them
  • Modularity makes it play well with 3rd party framworks and libraries
  • Excellent monitoring support with Metrics
  • Very large community support
  • The quality of available documentation has improved since I last review it
 

Con

 
  • As it is glued together it also includes 3rd party framework/library issues and bugs so take care
  • Make sure you’re using newer Dropwizard versions; some of the older ones are using deprecated 3rd party libraries. Plus earlier Dropwizzard versions were harder to upgrade.

 

Author notes

 
I don’t want to recommend this framework for larger projects, but if you’re willing to give it a try, you will not be disappointed. If anything because this framework uses the best modern Java-based web application components available, packaged into an easy-to-use framework.
 
Unfortunately what makes it strong also makes it weak. Mixing all those libraries can cause unforeseen problems, that’s why I gave it 1/2 star less than 5 of 5.
 
Introduction date: Sep 19, 2016
Rating: 5/5
 
This framework is a RESTful API framework built on top of light-4j, which is on its own a fast, lightweight and cloud-native micro-service framework.
 
To my knowledge, at the time of this update, Light Java is also the fastest available Java micro-service. If you visit their website you will notice that developers are bragging about been 44 times faster than Spring Boot running in the embedded Tomcat.
 

Links

 
 
Official Site GitHub Examples Documentation
 
 

Pro

 
  • Fastest available micro RESTful framework
  • Very low latency
  • Cutting edge
  • Small memory footprint which is important when working with Java
  • Plays nice with other libraries/frameworks
  • In-house dependency injection framework included so you have avoid using 3rd party solutions
  • Designed for scalability
  • Organized around plugins so you can make it as small as possible
  • Based around JavaSE so no need for J2E
  • Security first design – OAuth2 integration
 

Con

 
  • Such a fast framework has such a bad documentation, some sections are even missing.
  • While it’s growing in popularity it still has a rather small following

 

Author notes

 
While I’m currently working with Spring Boot I’m not planning to switch to Light-rest-4j anytime soon. While it’s much faster than Spring Boot it’s still not powerful enough to stand on its own feet. Let’s be honest, the best is usually not the right this to choose (example VHS vs. Betamax).
 
Introduction date: 2012
Rating: 3.5/5 (I’m not impressed enough)
 
Ninja Web Framework is a full-stack web framework for Java. Stable, fast, reliable, and super productive.
 
It provides everything you need to develop, test, deploy, and maintain your RESTful web application (Servlets, Guice, JPA, Flyway migrations, Maven, etc.).
 
Just like DropWizzard, Ninja Web Framework is an integrated software stack. You don’t have to setup everything on your own, just generate a new project from using Maven archetype, import it into available IDE and start coding.

Links

 
 
Official Site GitHub Documentation
 
 

Pro

 
  • Fast
  • Quick project building and bootstrapping
  • Modularity
  • XML, HTML, JSON rendering
  • Other libraries are also supported, you may or may not use them (like Guice, Logback, Guava, etc.).
  • Good data persistence support and caching
  • Don’t like servlet container? Use any container you like.
  • Don’t want to use containers at all? Use it in stand-alone mode, as a self-executing jar package bundled with Jetty.
 

Con

 
  • Again, just like with DropWizzard, provided documentation is good but not good enough. It took me some time to get acquainted. Also, this framework relies on so many other libraries that sometimes it can become cumbersome to find needed information.
  • Not that famous, so expect much smaller community. According to some rumors, this framework was built by/for Play users who didn’t like Play 2.X switching mainly to Scala. Please leave a comment below if you think this is not correct.

 

Author notes

 
It sounds like a great framework, but I will leave it on the side until it matures a little bit more.
 
Continue Reading

  • Antonio Garcia

    Hi
    I use this framework in my last work. I pick over other for the benchmark. This is because the use of Jetty.
    I do not use the framework at 100%, the core and JDBI but the documentation is very terse = much StackOverflow.
    JodaTime is included what is interesting.

  • Edgar Espina

    Good article!

    Here is another micro framework: http://jooby.org (I’m the author)

    It runs on top of netty (default), jetty or undertow. It has a scripting programming model but also MVC.

    • Ahmmad Ismail

      I am pretty much considering your framework. However, It will be great if you can provide some video tutorials. Otherwise it is hard to gain confidence to get started for a project on which I will be stick to for next 4/5 years at least.

  • My advice, go to the Ionic official forum. Sort answers by “number of replies”, and you’ll find your answer somewhere on the top. It’s a standard Ionic question.

  • C B Newham

    I don’t know why you claim Spark is not intended for beginners. I’m no expert on restful frameworks (Spark was the first I used) but I found the documentation to be adequate and it does exactly what I want with minimal fuss.

  • Thanks I will check it out

  • Thanks I will check it out, do you mind if I contact you with few questions?

    • Feel free to contact me with any question you might have.

  • Jay Ma

    No RestEasy?

  • Danio

    Great article. Can you explain these two:

    “Most commonly used with AngularJS”
    – isn’t AngularJS alone enough to develop front-end and just call backend without use of Spark framework?

    “Can be used inside a container or without one”
    – you wanna tell it does not have to use Jetty at all.. it is configurable? I did not know that

  • Jonathan Airey

    Dropwizzard -> Dropwizard.

  • Yohanes Pradono

    I am new to Java and am building a simple restful application. I am considering Dropwizard, Jersey, or Play2. still struggling on where i should put my faith on.
    Which one is the simplest to deploy on server?
    I am developing on windows and my server uses Linux.

    • Ferran Maylinch

      Would recommend Spring Boot or Dropwizard. Not Play, it has too many issues.
      Dropwizard is easy to use. Spring Boot too, and Spring products are always of high quality and well documented.

      • Madhu Sudhan

        go with dropwizard.easy to build and deploy

  • Yohanes Pradono

    Does grails require you to know Groovy? or it can be developed using java only knowledge?

  • Hestia

    I wanted to use Jersey, but the teacher forces us to use an other frmaework.

  • Steve Hu

    I maintain a microservices framework benchmarks which can give you an estimate of overhead for each framework. As latency, throughput and memory footprint are three most important factors for microservices. Hope it helps.

    https://github.com/networknt/microservices-framework-benchmark

  • Johanneke

    This is an AWESOME overview! Okay, I’m missing RESTEasy, which is one of the frameworks I’m considering. But the structure of your post is great, with a description, pro’s, con’s, author notes and the EXAMPLES! Small enough to not scare anyone away, but it gives an impression of the kind of code you’ll be writing. Thank you!

  • greenlaw110

    Hey, maybe you want to checkout this new framework:
    http://actframework.org/

    Plus the performance comparison between ActFramework and many of the framework listed in your blog:
    http://tfb-insight.thinking.studio/#vs/actframework:spring:dropwizard:ninja-standalone:light-4j:play2:spark

    The data comes from the latest TechEmpower framework benchmark: https://www.techempower.com/benchmarks/previews/round15/

    I’ve also calculated lines of source code vs tests implemented and come up with an new benchmark item: code density, in order to measure how expressive a framework can be when creating the TechEmpower benchmark project.

    Link to test project source is provided in each framework’s detail page, e.g. http://tfb-insight.thinking.studio/#framework/dropwizard