Skip to content

Quarkus

A Java stack built for containers — fast startup, low memory, first-class native compilation.

Web & HTTPWebJava

What it is

Quarkus is a Kubernetes-native Java framework designed for building cloud-native, reactive, and serverless applications with fast startup times and low memory footprint.

Quarkus allows building REST APIs, reactive services, microservices, and serverless applications. It provides seamless integration with Hibernate, JPA, messaging systems, and cloud-native features, with support for reactive and imperative programming models.

Licence
Apache 2.0
Maintained by
Red Hat

When to use it

The question documentation cannot answer for you — because it cannot recommend something else.

Reach for it when

  • Serverless functions or Kubernetes workloads where startup time and memory cost real money
  • You want GraalVM native images without fighting reflection configuration

Look elsewhere when

  • The team's expertise and libraries are all Spring — the ecosystem gap is real
  • It is a long-running service where JVM warm-up is irrelevant

Installation

Add io.quarkus:quarkus-bom and required extensions in pom.xml

Getting started

The smallest useful thing you can do with it, and what each part means.

Creating a simple REST endpoint
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;

@Path("/hello")
public class HelloResource {
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String hello() {
        return "Hello Quarkus!";
    }
}
Defines a basic REST endpoint that responds with 'Hello Quarkus!' on GET requests to `/hello`.
Starting a Quarkus application
import io.quarkus.runtime.Quarkus;
import io.quarkus.runtime.annotations.QuarkusMain;

@QuarkusMain
public class MainApp {
    public static void main(String... args) {
        Quarkus.run(args);
    }
}
Bootstraps a Quarkus application using the main method.

Advanced usage

Where the library earns its place over a simpler alternative.

Dependency Injection
import jakarta.inject.Inject;
import jakarta.inject.Singleton;

@Singleton
public class MyService {
    public String getMessage() { return "Service Message"; }
}

@Path("/service")
public class ServiceResource {
    @Inject
    MyService myService;

    @GET
    public String message() {
        return myService.getMessage();
    }
}
Demonstrates injecting a service into a REST resource using Quarkus and Jakarta DI.
Reactive REST endpoint with Mutiny
import io.smallrye.mutiny.Uni;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;

@Path("/reactive")
public class ReactiveResource {
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public Uni<String> hello() {
        return Uni.createFrom().item("Hello Reactive Quarkus!");
    }
}
Defines a reactive REST endpoint using Mutiny for asynchronous, non-blocking responses.
Using Hibernate ORM with Panache
import io.quarkus.hibernate.orm.panache.PanacheEntity;
import jakarta.persistence.Entity;

@Entity
public class Person extends PanacheEntity {
    public String name;
    public int age;
}
Defines a simple entity with Quarkus Panache for ORM support with minimal boilerplate.
Configuration properties
import io.quarkus.arc.config.ConfigProperties;

@ConfigProperties(prefix="app")
public class AppConfig {
    public String name;
}
Maps configuration properties from application.properties or application.yml into a Java class.

Errors and fixes

The failures you are most likely to hit, and what actually resolves them.

Port already in use
Change the HTTP port in application.properties or ensure no other service is running on the same port.
Dependency injection failure
Check for missing beans, circular dependencies, or misconfigured @Inject annotations.
GraalVM native image build failure
Ensure all reflection and dynamic proxies are properly registered or use Quarkus native image extensions.

Best practices

  • Use reactive programming with Mutiny for high-performance non-blocking services.
  • Leverage Panache for simpler and efficient ORM operations.
  • Externalize configuration and use type-safe config classes.
  • Organize code with REST resources, services, and entities for modularity.
  • Integrate Quarkus with CI/CD pipelines for containerized deployments.

Alternatives

Comparable options, and the reason you would pick one over the other.

Background

Why it exists, and what it was reacting to.

Quarkus was created to optimize Java for containerized environments and serverless deployments. It leverages compile-time boot, GraalVM native image support, and reactive programming to provide a high-performance and developer-friendly framework for modern applications.