Encodera

Thanks for reading!

Donate to the site — we work hard for you.

Contents

What Quarkus is

Quarkus is a framework for server-side Java applications. It helps you write a REST API or a microservice quickly: it accepts HTTP requests, turns objects into JSON, works with a database and checks access rights. The main idea of Quarkus is that an application should start fast and use little memory, so it is convenient to run in the cloud and in containers.

Why Quarkus is fast

A typical Java framework scans classes, reads annotations and builds internal structures on every start. Quarkus does most of this work in advance, while the project is being built. This approach is called build-time processing. As a result:

WhatWhat it gives you
Fast startupThe application starts in seconds, a native build in tens of milliseconds
Low memoryFewer classes are loaded at run time
Dev modeYou change the code and it works at once, without a manual restart
Native buildThe application can be built into a plain executable without a JVM

Standards instead of a custom API

Quarkus does not invent new annotations where a standard exists. You write code with familiar Jakarta EE and MicroProfile specifications:

  • Jakarta REST — the @Path, @GET, @POST annotations for REST endpoints;
  • CDI — dependency injection with @Inject;
  • Jakarta Persistence and Hibernate ORM — working with a database;
  • MicroProfile Config — settings from application.properties.

Features are added with extensions — Maven dependencies such as quarkus-rest or quarkus-hibernate-orm-panache. Need a database? Add the extension. Don't need it? It is not in the project.

The version in this course

The course is written for Quarkus 3.40 and Java 25. Quarkus 3 runs on Java 17, 21 and 25; the project generator picks the Java version it is running on. The build tool is Maven.

Check that Java is installed:

java -version

The command should show version 25 (21 works too). You do not have to install Maven separately: every Quarkus project contains the mvnw wrapper, which downloads Maven by itself.

What we will build

Throughout the course we build a REST API for a blog:

  1. /posts endpoints to list, show, create and delete posts.
  2. Comments on posts and a database through Hibernate ORM with Panache.
  3. Input validation, error handling and configuration.
  4. Tests, health checks, metrics and password protection.
  5. A build into a jar, a native executable and a container.

We call the API with curl, a command-line tool for HTTP requests. It is available in Windows 10+, macOS and Linux.

Common mistake

Quarkus needs Java 17 or newer. With an old Java the very first command fails with an error like this:

UnsupportedClassVersionError: io/quarkus/bootstrap/runner/QuarkusEntryPoint has been compiled
by a more recent version of the Java Runtime (class file version 61.0), this version of the
Java Runtime only recognizes class file versions up to 60.0

Number 61 is Java 17, and 60 is Java 16. Install JDK 25 and make sure the JAVA_HOME variable points to it.

Thanks for reading!

Donate to the site — we work hard for you.