What are Java micro frameworks and why should you use them?

Java Micro Frameworks

Every language has tradeoffs. With Java, the tradeoff for being a safe, rigorously tested, backwards compatible language is making some sacrifices around agility and streamlining. There’s undeniably some verbosity and bloating, however, the JVM is hugely appealing as a backend if you really want to dive into things or go to high scale. It’s powerful and has been tested in the harshest of environments. Java is widely used and strongly deployable for a reason, after all.

Not everyone is accepting the state of things as they are however. Several people have taken a stab at trying to find ways around the bloat of Java and still keep the power of the JVM. The first wave was around lightweight Java frameworks (a few of which we wrote about: Dropwizard vs. Springboot). These delivered lightweight, modern frameworks for Java and helped cut down development time. Now there’s a second wave that’s been recently hitting the scene. That wave is Java micro frameworks.

What is a Java micro framework?

As a language matures, one unavoidable effect with each release is that well-established libraries grow and swell. After a point, much of the functionality wrapped in those libraries is no longer really needed for most projects. Micro frameworks are an attempt to address this. The idea is to create a focused and agile solution that takes the production process down to its basics.

Micro Java frameworks are essentially a continuation of the lightweight Java frameworks journey. They are the lightest possible way to do Java today. As the new kids on the block, they haven’t been deployed across every type of production environment yet, but the early production deployments have shown strong success. Their appeal is clear and there’s a lot of excitement and active development in this space right now.

Today, I’m taking a look at three of the more popular Java micro frameworks available: Ninja Framework, Spark, and Jodd.

Java micro frameworks Github
Java micro frameworks – Github stats

Ninja Framework

Ninja framework
Ninja is a full stack micro Java framework for creating webservices and applications. It aims to take the positive aspects of Play and Ruby on Rails and deliver them through a pure Java format. It uses an MVC concept in order to facilitate simplicity and the ability to write applications of any size in a consistent manner.

As an integrated software stack, Ninja comes with an extensive amount of functionality out of the box (e.g. JSON parsing, metrics support, HTML rendering), which requires some annotations and definitions for your controllers. Much of these functionalities are based around making Ninja a DevOps-friendly tool. The inclusion of these libraries make Ninja easy to use. On the scalability front, Ninja is a stateless design, which makes horizontal scaling just a matter of adding servers.

The tradeoff for the functionality and ease of use is less user choice and a larger footprint than some other tools in this space. The structure for development is chosen for you and a set of source folders and files are created automatically.

Popularity and Libraries: On Github, Ninja has 809 stars and 288 forks as of this writing, which is comparable to Jodd, but well behind Spark in popularity. If you want to contribute, check out the Github page. For HTML rendering, Ninja uses Freemarker. For handling JSON and XML, Jackson is used. Many of the core libraries are written by Ninja.

Getting Started: Getting started with Ninja is fairly straightforward. It’s based in Maven, requiring Java and Maven to run. Ninja projects work through Maven archetypes, which allow users to build new projects with a single command once they’re built. To kick off your first project, the command is

mvn archetype:generate -DarchetypeGroupId=org.ninjaframework -DarchetypeArtifactId=ninja-servlet-archetype-simple

Once you enter a few values and move into your project directory, executing the following will start Ninja in its “SuperDevMode” (which picks up changes you make automatically):

mvn clean install // to generate the compiled classes the first time
mvn ninja:run // to start Ninja's SuperDevMode

From there, you import your project into your IDE of choice and start coding. For further details, check out the documentation.

Takeaway: Ninja Framework redesigned the Java framework to deliver something that is simple, scalable, and easy to use. It delivers a lot of functionality that makes it easy for a user to get up and running quickly. As a full stack framework, you do get a larger footprint and less customizability than with some other options.


Not to be confused with Apache Spark, the goal of this Spark was to design a pure Java framework that could be used for easily and simply creating REST APIs and/or web applications. At less than 1 MB in size, Spark is an agile and slimmed down framework that can be used for quickly and easily developing applications. Initially inspired by Sinatra, Spark has grown into a fully realized web framework with an engaged developer community that continues to maintain an active release cycle.

As a micro framework, Spark made the decision to let users pick their template engine(s) for designing their application. The flexibility they provide for choice of libraries allows for users to choose the best options for their projects without any lock-in or learning curve difficulties for ecosystem particulars. And since they’re focused on delivering a small footprint solution, there’s little configuration or boilerplate required.

The tradeoff for the flexibility and simplicity of Spark is less functionality than other options out there. Spark aims to be as streamlined and straightforward as it can, stripping out the need for many extra efforts like excessive annotations and XML configurations. In order to be super lightweight, it sacrifices some potentially useful functionalities.

Getting Started: Getting started in Spark is extremely simple. It requires Java and Maven to run. The first step is adding a Maven dependency:


The second step is to import Spark and start coding:

import static spark.Spark.*;
public class HelloWorld {
    public static void main(String[] args) {
        get("/hello", (request, response) - > "Hello World!");

For additional details, check out the documentation.

Popularity and Libraries: On Github, Spark has 2,398 stars and 542 forks as of writing, making it easily the most popular of the three frameworks I’m spotlighting here today. If you want to contribute, check out the Github page. Part of the flexibility Spark offers is not locking users into specific libraries. For example, for HTML rendering, you could use Freemarker, Mustaches, Velocity, Jade, Handlebars, Pebble, or Water. For whichever you want to use, add a Maven dependency to set it up.

Takeaway: Spark strips out a lot of Java bloat and delivers a minimalistic and flexible web framework that is simple to set up and can be used to create a wide range of Java projects. By slimming way down however, you do lose some functionality, so Spark isn’t ideal for large scale web applications.



Jodd is a collection of micro frameworks, tools, and utilities for Java, so it’s perhaps not directly comparable to some of the others here. In fact, Spark could likely be included as a component of Jodd for example. But the driver for Jodd is to reduce the footprint and slowness of many Java tools and frameworks, and deliver a selection of super lightweight frameworks and tools. Rather than group them all together in one monolith application, Jodd breaks each library down into its own individual piece, which allows the user to pick and choose which ones they use.

Jodd has been around for a while, and over that time they’ve built lightweight versions of tools and utilities whenever they’ve noticed a need. By keeping the tools and frameworks separate and delivering them as a loose bundle, Jodd can keep extremely focused scopes for each individual piece. They have frameworks for handling requests, for DI containers, for parsing HTML5, and so on. A collection like this can seem to go against the idea of streamlined micro frameworks, but the entire bundle comes in at under 1.5 MB, so the footprint is small.

The tradeoff with Jodd is that it’s not done for you. The functionality for most things is there in the collection of libraries, but you have to get your hands dirty and get it set up yourself. The customizability provides a lot of control and flexibility for the user, but that comes with less ease of use. Fortunately, each individual tool is simple and tiny, so diving into the code doesn’t require wading through a sea of complexity. The documentation on the Jodd site provides some guidance and best practices as well.

Getting Started: Jodd is built with Gradle and is targeted to Java 1.5 and above. As Jodd is a collection of tools, getting started is not as straightforward as other tools. One option is to download the Jodd bundle to get all the modules. Another option is to build Jodd from the source through Git. To do so,
Clone the Jodd Git repo:

git clone https://github.com/oblac/jodd.git jodd

then build the project with:

gradlew build

You can also install Jodd in Maven. To do so, use the command:

gradlew install

For more details about the different modules and some examples on how you can use them, check out Jodd’s documentation.

Popularity and Libraries: On Github, Jodd has 837 stars and 243 forks as of writing, making it comparable in popularity to Ninja, but well behind Spark. If you want to contribute, check out the Github page. Jodd is a collection of utilities, frameworks, and tools, so the libraries it uses are its own.

Takeaway: Jodd is a collection of very focused and lightweight frameworks and tools. Users can combine these libraries in a huge number of ways to get customized solutions for their needs that still deliver a lot of functionality. By breaking down each element into a different piece however, the onus is on the user to dive in and get everything set up the way they need it.


Java micro frameworks are an attempt to address the weaknesses of Java while maintaining its strengths. Their focused, bare bones approach allows for very light application deployment, helping developers combine the power of the JVM with the agility of newer, faster languages.

As a newer development, defining what qualifies as a Java micro frameworks can be a matter of opinion. Depending on how you want to define the term, there are several others you can include and explore, such as JHipster, Javalite, Ratpack, and Vert.x. If you’ve worked with micro frameworks in the past, please let us know your opinions on them in the comments section below.

Further reading: 

blog_boat (1)

The 7 Log Management Tools Java Developers Should Know

Josh does product marketing for OverOps. He's a big baseball fan and a small beer nerd.
  • Danny Hyun

    Thanks for showing that Java doesn’t have to be verbose and unfun.

    Have you heard of Ratpack? It’s a pretty great Java web framework


  • Serban Balamaci

    Also I may point out this little guy Pippo – really lightweight(around 100k for core) and modularized


  • Jeff Schnitzer

    Another micro-framework you may want to look at is GWizard:


    It’s basically DropWizard but reimagined using dependency injection and Guice. This cuts the amount of code down *dramatically*, both in the framework and in your code. The project is fairly new so it doesn’t have a lot of stars yet, but it’s growing.

  • http://tomassetti.me Federico Tomassetti

    I think there is a change in mentality made possible by some features of Java 8 (lambdas above all). I was pleasantly surprised by Spark: using it in combinations with the right libraries make Java seems much more agile then usual. If you want to read some additional insights on using Spark take a look at http://tomassetti.me/getting-started-with-spark-it-is-possible-to-create-lightweight-restful-application-also-in-java/ or http://sparktutorials.github.io

    • Josh Dreyfuss

      Thanks for the additional links. I’d agree that some new possibilities have been opened up in Java 8. I’m glad people out there are exploring them

  • http://www.jooq.org Lukas Eder

    Did we just read each others’ minds? We just published this article here:

    Nice to see that you essentially agree 🙂

    • Josh Dreyfuss

      Good stuff! Thanks for sharing

  • Josifov Gjorgi

    Nice blog for a new way of doing the old things.
    I was always wonder what does a micro stands for: memory/jar/cpu footprint ?
    “Their focused, bare bones approach allows for very light application deployment” does this means that I can change the application code in runtime and don’t have to do a restart the applicaton ? Because for me light application deployment is no restart at all, changing things on the fly just like the Jrebel does. If I have to restart I going to use java ee 7 (1.9 MB) on wildfly, because it’s restarts under one second.
    I don’t see any real benefits from micro frameworks that I already have with ee or spring, except of course that is a new api, which is a copy from frameworks like RoR, Sinatra etc, which these other frameworks copy from j2ee and made it the right from developer perspective.

    • Josh Dreyfuss

      Thank you!

      As I mentioned, there’s some flexibility in how you define micro frameworks, but I’d say generally they’re micro more in the sense of less code and smaller jars, rather than around memory or CPU

  • Miloš Žikić

    Jodd is a great collection of micro frameworks and definitely recommendation for trying to use it on your next project. We are using it’s components on many projects and they work on Android as well and helped us save a lot of time (kudos to Jerry 😉

  • Dathan Pattishall

    Would you consider Boon to be a microframework?

    • Josh Dreyfuss

      From taking a quick look at their website, it looks like Boon shares similar motivations with many micro frameworks, but I don’t know if I would count it as one today. Looks like a lot of micro framework-type elements are on the roadmap though, so that could change if development continues as planned

  • Jacobus Reyneke

    Nice concise post, thanks.

    Akka-HTTP is worth a mention 😉 It may not be a framework as such, but got the goods needed for rock solid and scalable microservices in Java or Scala.

    • Josh Dreyfuss

      Thank you! There’s a lot of cool stuff happening around Akka in general these days

  • Nick Okunew

    I’m a maintainer of thundr, another light-weight alternative web mvc/rest/DI framework. It probably has more grey hairs that some of the others posted here, but is less widely used.


    It actually uses Jodd for a lot of the more tricky utility and reflection code, a highly recommended set of libraries.

  • stingh711

    I think spring-boot can also be listed as micro framework, though its dependencies are not micro. But it is easy to setup and easy to use.

    • Josh Dreyfuss

      We wrote about Spring Boot here in our post on lightweight Java frameworks

  • http://ubercx.io UberCX Support

    Well, how about Spring Boot and Dropwizard? We recently wrote blog about comparing these two micro frameworks -> . http://blog.ubercx.io/java-frameworks-for-microservices/


  • Edgar Espina

    Java can be fun for sure! Here is my micro frameowork: http://jooby.org

    It has multi-server setup (netty, jetty, undertow) and/or you can write the whole app in JavaScript (via Nashorn)

  • http://xenoterracide.com/ Caleb Cushing

    Spark is really going to need a branding change, it could be awesome but I can’t imagine trying to search for help on it.

  • Ajay

    Please let me know, Why we should move on spark micro framework or other micro framework? and what are the advantage over Spring Framework

  • Tharindu Abeydeera

    Thanks for the comprehensive comparison and what about http://javalite.io ? as for github stats, its not so popular but it seems to have nifty modules like ActiveJDBC. Haven’t used it though. I guess this post needs an update.