liveBook · Manning

Build-time property

As explained in Quarkus in Action

A build-time property is a configuration value whose effect is fixed or incorporated while an application is being built.

A build-time property is a configuration value that Quarkus reads and acts upon while building an application. Its effect is incorporated into the built artifact, so changing it at startup can cause inconsistencies and produces a warning rather than a runtime change. section 12.1.3 section 2.5

Use a build-time property when a value determines generated or registered application structure:

  • Swagger UI properties such as quarkus.swagger-ui.title and quarkus.swagger-ui.theme control HTML generated during the build; runtime overrides have no effect. section 12.1.3
  • An extension can expose a build-time endpoint path, such as quarkus.metadata.path, when it registers the HTTP handler during the build. section 12.3.2
  • Do not classify values as build-time merely because they are configuration: quarkus.http.port remains a runtime property because the application must bind to the port when it starts. section 12.1.3

Custom extensions declare build-time configuration in their deployment module. A configuration root marks the phase as BUILD_TIME, supplies a prefix, documents each entry, and may provide a default. The extension then consumes the value while registering its build-time behavior. section 12.3.2

Listing 12.4 The configuration object for the Metadata extension
package org.acme.metadata.extension.deployment;

import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;

@ConfigRoot(phase = ConfigPhase.BUILD_TIME)  #1
@ConfigMapping(prefix = "quarkus.metadata")
public interface MetadataExtensionConfig {

    /**
     * The path to the metadata endpoint.
     */
    @WithDefault("/metadata")
    String path();
}

The configuration object demonstrates a BUILD_TIME configuration phase, the quarkus.metadata prefix, and a default /metadata endpoint path. section 12.3.2

How Quarkus in Action covers it

How deep it goes
Explains build-time versus runtime configuration, warnings, examples, and a Java configuration declaration, but not the complete handler implementation.
Examples
Uses Swagger UI generation, quarkus.metadata.path, and quarkus.http.port to contrast build-time and runtime values.
What it assumes
Assumes basic configuration knowledge and introduces the distinction between MicroProfile Config values and Quarkus-managed build phases.
What you can do after
Operate/configure Quarkus extensions by declaring build-time configuration and recognizing settings that cannot change at startup.
How it connects
Connects Quarkus extensions, runtime configuration, MicroProfile Config, ahead-of-time compilation, and HTTP endpoint registration.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quarkus in Action. The section links point to the parts of the book it draws on.