Quarkus — Cheat Sheet

Tags: java, quarkus, graalvm, kubernetes, reactive, microservices

Level: intermediate

TL;DR: Supersonic Subatomic Java framework tailored for GraalVM and Kubernetes with build-time metadata processing and a reactive-first architecture.

Key concepts

Build-time boot executes reflection, annotation scanning, and dynamic proxy generation ahead of time.

GraalVM native compilation produces standalone binaries with millisecond startup times and tiny RSS memory footprints.

Dual execution model integrates imperative worker threads and non-blocking reactive event loops on Eclipse Vert.x.

Mutiny library drives reactive pipelines using Uni for single items and Multi for event streams.

Zero runtime reflection reduces classloading overhead and minimizes memory consumption in production environments.

ArC provides a lightweight, build-time dependency injection container implementing Jakarta CDI specifications.

Dev Services automatically provisions Docker containers for databases and message brokers during local development.

Hibernate ORM with Panache simplifies entity management using Active Record or Repository patterns.

Typical questions and ready answers

Q: How does Quarkus achieve faster startup and lower memory than traditional Spring Boot?R: Quarkus moves classpath scanning, proxy generation, and reflection to compile time, producing pre-initialized bytecode or a GraalVM native binary.

Q: What is the difference between Uni and Multi in Mutiny?R: Uni represents an asynchronous computation emitting zero or one item, whereas Multi represents an event stream emitting zero to many items.

Q: When should you choose JVM mode over GraalVM Native mode in Quarkus?R: I choose JVM mode for long-running services requiring maximum peak throughput from JIT, and Native mode for CLI tools, serverless, or rapid autoscaling.

Pitfalls and common mistakes

Executing blocking calls such as classic JDBC or Thread.sleep directly on the reactive Vert.x event loop.

Missing @RegisterForReflection on external DTOs, causing silent serialization failures in native binaries.

Relying on full dynamic CDI features unsupported by ArC build-time analysis.

Neglecting build-time configuration properties that cannot be overridden at runtime via environment variables.

Snippets and commands

./mvnw quarkus:dev

Bash

./mvnw package -Dnative -Dquarkus.native.container-build=true

Java

@Path("/products")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class ProductResource {
    @GET
    public Uni<List<Product>> listAll() {
        return Product.listAll();
    }
}

To review

[ ] GraalVM reflection registration flags and substitution classes

[ ] Mutiny pipeline composition, error handling, and backpressure

[ ] Panache active record pattern versus repository pattern trade-offs

[x] Quarkus Dev Services automatic container configuration

References

Quarkus Official Guides (quarkus.io/guides)

SmallRye Mutiny Documentation

Eclipse MicroProfile Specifications

Jarvis Interviews
Jarvis