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
