This Java/Gradle based repository illustrates a selection of Java-based microframeworks.
It implements a functionally identical grocery list application with Spark, Ninja, Ratpack, Jodd, Pippo, JavaLite, and a few others.
It was originally meant as supplement for my article on heise developer online (german) but is also the basis for my talk Schlank in den Service: Der große Java-Microframework-Test! on the Javaland conference 2018.
- Installed JDK 8+ with proper set
JAVA_HOME
environment variable
This repository comes with a pre-bundled Gradle Wrapper
gradlew
or gradlew.bat
(Windows) which will download the appropriate build dependencies automatically on the first
run.
Optional (recommended for development):
- Gradle 4.5+
- Lombok Plugin for your IDE of choice (Guide: IDEA, Eclipse, …)
- IntelliJ IDEA (preferably Ultimate Edition for full Framework support)
Spark is a tiny Sinatra inspired framework for creating web applications in Java 8 with minimal effort
Run the demo with gradle :spark:run
and access http://localhost:8080/
Open the project using IntelliJ IDEA Ultimate and execute the Spark: Run Example run configuration.
Let gradle build the all-in-one UberJAR and directly execute it with Java (preferrably in the spark/
directory to leverage from the example grocerylists.json
.
gradlew :spark:shadowJar
cd spark
java -jar build/libs/spark-1.0-SNAPSHOT-all.jar
Ninja is a opinionated, full stack framework including dependency injection, a optimized development mode and support for relational DBs.
Run the demo with gradle :ninja:run
and access http://localhost:8080/
and http://localhost:8080/hello
Open the project using IntelliJ IDEA and execute the Ninja: Run Example run configuration.
Let gradle build the all-in-one UberJAR and directly execute it with Java (preferrably in the ninja/
directory to leverage from the example grocerylists.json
.
gradlew :ninja:shadowJar
cd ninja
java -jar build/libs/ninja-1.0-SNAPSHOT-all.jar
Ratpack is a reactive-oriented, type-safe microframework heavily based on Java 8 lambdas and Netty for non-blocking IO.
Run the demo with gradle :ratpack:run
and access http://localhost:8080/.
Open the project using IntelliJ IDEA and execute the Ninja: Run Example run configuration. ``
Let gradle build the all-in-one UberJAR and directly execute it with Java (preferrably in the ratpack/
directory to leverage from the example grocerylists.json
.
gradlew :ratpack:shadowJar
cd ratpack
java -jar build/libs/ratpack-1.0-SNAPSHOT-all.jar
Jodd is set of Java micro frameworks, tools and utilities, under 1.7 MB. The framework consists of micro components, which can be used more or less independently.
Run the demo with gradle :jodd:run
and access http://localhost:8080/.
Open the project using IntelliJ IDEA and execute the Jodd: Run Example run configuration. Jodd by default has no embedded servlet container bundled. The example includes and configures a Undertow server as embedded server.
This module originally did not provide an all-in-one UberJAR. Follow these steps to build a WAR file:
gradlew :jodd:war
cp jodd/build/libs/jodd-1.0-SNAPSHOT.war [tomcat]/webapps
Run the demo with gradle :jodd:jettyRun
and access http://localhost:8080/jodd/.
____ ____ ____ ____ _____
( _ \(_ _)( _ \( _ \( _ )
) __/ _)(_ ) __/ ) __/ )(_)(
(__) (____)(__) (__) (_____)
Pippo is set of Java micro framework in the spirit of Sinatra but also offers a Controller-based approach. The core is small (around 140 KB) and can be extended with various modules for template engine or embedded web servers.
Run the demo with gradle :pippo:run
and access http://localhost:8080/.
Open the project using IntelliJ IDEA and execute the Pippo: Run Example run configuration.
Let gradle build the all-in-one UberJAR and directly execute it with Java (preferrably in the pippo/
directory to leverage from the example grocerylists.json
.
gradlew :pippo:shadowJar
cd pippo
java -jar build/libs/pippo-1.0-SNAPSHOT-all.jar
Spring Boot favors convention over configuration and is designed to get you up and running as quickly as possible. Spring WebFlux is the reactive successor of Spring MVC and a is fully non-blocking, back pressure-supporting web framework.
Run the demo with gradle :spring5:run
and access http://localhost:8080/.
Open the project using IntelliJ IDEA and execute the Spring 5: Run Example run configuration. Potentially this requires IDEA Ultimate Edition.
Let gradle build the all-in-one UberJAR and directly execute it with Java (preferrably in the spring5/
directory to leverage from the example grocerylists.json
.
gradlew :spring5:shadowJar
cd spring5
java -jar build/libs/spring5-1.0-SNAPSHOT-all.jar
This project uses Gradle 4.6+ as build tool and IDEA IntelliJ inspections together with my idea-cli-inspector tool for quality assurance.
The great Travis CI service acts as CI service executing Tests and IDEA inpsection.
If you want to perform the IDEA Inspections within your own IDE:
- Select Analyze > Inspect Code …
- The select Custom Scope: "Showcase Sources" & include test sources
- As inspection profile
exxcellent-2017
should be preselected.