This Java/Gradle based repository illustrates a selection of Java-based microframeworks.
It implements a functionally identical grocery list application with Spark, Ninja, Ratpack and Jodd is meant as supplement for my article on heise developer online (german).
- 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 2.8+
- Lombok Plugin for your IDE of choice (Preferably: IntelliJ IDEA UE)
- IntelliJ IDEA (Ultimate Edition)
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:5050/.
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.5 MB. The framework consists of micro components, which can be used more or less independently.
Run the demo with cd jodd
and gradle jettyRun
and access http://http://localhost:8080/jodd/.
This example has no embedded servlet container bundled. To run you need to download a Jetty 8 container and use the commericial IntelliJ IDEA Ultimate edition. Open the project and configure the jodd: Run in Jetty run configuration. Check for a proper reference to a valid Jetty 8 installation under Application Server, then run the configuration.
This module does not provide a all-in-one UberJAR. Following how to build a WAR file:
gradlew :jodd:war
cp jodd/build/libs/jodd-1.0-SNAPSHOT.war [tomcat]/webapps