Skip to content
Tutorials Center
My learning

Topics

Lesson 26 of 36 ยท Native Images and Dev Mode

Dev Mode, Live Reload and Dev Services

Use quarkus dev for instant live reload, continuous testing, the Dev UI and Dev Services that start databases, Kafka and more in containers with zero configuration.

Many frameworks make you rebuild, restart and wait. Quarkus aims for the opposite: you change a file, you refresh the browser, and the new behavior is there. This is dev mode, and together with its companions, continuous testing, the Dev UI and Dev Services, it is the main reason people enjoy daily work with Quarkus.

This lesson explains what dev mode really does, how to use each helper, and where its limits are. Quarkus itself cannot run on this site, so commands and files are shown read-only, and the TryIts model the two core mechanisms (change detection and "start it only if it is not configured") in plain Java.

Starting dev mode

From a project created with the Quarkus CLI or code.quarkus.io:

Terminal
quarkus dev
# or: ./mvnw quarkus:dev      ./gradlew quarkusDev

The application starts in the dev profile (see profiles). Leave that terminal open and work:

You change What happens on the next request
A Java class Changed classes are recompiled and the application is restarted internally, usually in well under a second
application.properties Configuration is reloaded and the app restarts
A static file or template Served directly, no restart
pom.xml / build.gradle The dependency set is re-read and the app restarts

The reload is lazy and request-driven: Quarkus checks for changes when a request or a message arrives, not on a timer. If the build fails, the error is shown in the browser page, and the app is reloaded as soon as you fix it. You do not need an IDE plugin; a text editor works.

Dev mode only reloads the classes of your project. A change in a library you depend on, and some changes to build-time extension settings, need a real restart. Press s in the terminal to force a restart, or q to quit.

Keys in the dev terminal

Press h in the console to see them all. The most useful ones:

Key Action
r Toggle continuous testing
d Open the Dev UI
w Open the app in the browser
s Force restart
e Edit command-line arguments and restart
l Change log levels
q Quit

Continuous testing

Press r and Quarkus runs your tests, then re-runs the affected ones every time you change a class. It tracks which test touches which code, so a change to PriceCalculator only re-runs the tests that use it. Failures print in the console immediately. Combined with live reload this gives a very tight loop: edit, see the test turn green. Details are in testing with @QuarkusTest.

The Dev UI

Open http://localhost:8080/q/dev-ui. It is generated from the extensions you added. You will find:

  • the configuration editor with every property, its description and its current value;
  • the list of CDI beans, REST endpoints and scheduled jobs;
  • an OpenAPI and Swagger UI page when you have the quarkus-smallrye-openapi extension;
  • a database view for Panache entities, with a small SQL console (Dev Services database);
  • Kafka topics, with a way to publish and see records;
  • Continuous testing and build metrics, and the ability to add extensions with one click.

None of this exists in production: the Dev UI is only active in dev mode.

The dev-mode loop

Edit Change code or config.
Refresh The next request rebuilds.
Test Continuous testing re-runs.
Inspect Dev UI shows the state.

Seconds, not minutes.

1 / 2

Dev Services: zero-config infrastructure

Normally a database means installing it, creating a schema and putting a URL in configuration. With Dev Services, if an extension needs a service and you have not configured one, Quarkus starts a container for it (through Testcontainers, so Docker or Podman must be running), wires the connection properties automatically and stops the container when you quit.

XML
<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-jdbc-postgresql</artifactId>
</dependency>
<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-hibernate-orm-panache</artifactId>
</dependency>
PROPERTIES
quarkus.datasource.db-kind=postgresql
# no URL, username or password in dev: a PostgreSQL container is started for you
%prod.quarkus.datasource.jdbc.url=jdbc:postgresql://db:5432/shop

The trigger rule is simple: no URL configured means Dev Services starts one. The moment you set quarkus.datasource.jdbc.url (for %prod. only, as above), dev mode uses it only in the prod profile, so dev still gets a container. Related switches:

PROPERTIES
quarkus.devservices.enabled=false                 # turn all of them off
quarkus.datasource.devservices.enabled=false      # off for one
quarkus.datasource.devservices.image-name=postgres:16
quarkus.datasource.devservices.reuse=true         # keep the container between restarts
%dev.quarkus.hibernate-orm.database.generation=drop-and-create
%dev.quarkus.hibernate-orm.sql-load-script=import-dev.sql

The same happens in tests: @QuarkusTest runs against a fresh Dev Services database, which gives tests real PostgreSQL behavior without H2 differences. If Docker is not available, Dev Services is skipped with a log line and you must configure services by hand.

Java Stand-in: start a service only if none is configured

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with IO.readln() or a Scanner), it gets the next line from this box.

How reload works, briefly

Quarkus runs your application inside a special class loader. On the first request after a change it compiles the changed sources, throws away that class loader, creates a new one and re-runs the application startup against the new classes. Because Quarkus startup is fast (the framework's heavy work was done at build time, see how Quarkus works), this feels instant. Static state in your classes is of course lost on each reload.

Java Stand-in: detect only the changed files

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with IO.readln() or a Scanner), it gets the next line from this box.

Remote dev and other tricks

  • Remote dev mode (quarkus.live-reload.url) syncs changes from your machine to an application running in a container, handy for cloud-only dependencies.
  • Debugging: dev mode opens a debug port 5005 by default; attach your IDE's remote debugger.
  • Dev UI extensions let you add pages for your own services, and quarkus.dev-ui.cors.enabled is needed if the UI is behind a proxy.
  • Podman instead of Docker: Testcontainers can use the Podman socket; enable it and point DOCKER_HOST at it.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. When does dev mode check for code changes?

    Reload is lazy and request-driven; the first request after a change triggers the rebuild.
  2. 2. When does Dev Services start a database container?

    If you have configured the service explicitly, Quarkus uses yours; otherwise it starts a container.
  3. 3. What do you need for Dev Services containers?

    Containers are started through Testcontainers, which talks to a Docker-compatible runtime.
  4. 4. Which statement about the Dev UI is true?

    The Dev UI is a development tool, available at /q/dev-ui in dev mode and not in production.

Summary

  • quarkus dev gives lazy live reload, continuous testing, console shortcut keys and the Dev UI.
  • Dev Services starts databases, Kafka, Keycloak, Redis and more in containers when you have not configured them.
  • Use %prod. for production URLs so dev and test keep getting containers.
  • Reload throws away the class loader, so static state resets.

Next: How Quarkus Works: Build-Time Processing