A system property is a named value supplied to a Java process, commonly with the -Dname=value syntax. In Quarkus, it provides a deployment-time override when changing application.properties would require rebuilding the compiled artifact. section 3.2.3
Quarkus resolves configuration values in this order:
- JVM system properties take precedence over environment variables and application.properties. section 3.2.3
- Environment variables override application.properties when no system property supplies the value. section 3.2.3
- Environment-variable names capitalize the property and replace dots with underscores; for example, my.greeting becomes MY_GREETING. section 3.2.3
- Values in application.properties are not automatically exposed through System.getProperties() or System.getenv(); application code reads them through the MicroProfile Config API. section 3.3.1
Override a greeting in Dev mode
With greeting configured as Hello configuration in application.properties, run GREETING="Environment variable value" quarkus dev -Dgreeting="System property value". A request to /hello returns System property value. Removing -Dgreeting makes the endpoint return Environment variable value instead. section 3.2.3
Listing 3.4 Config override with system property
$ GREETING="Environment variable value" quarkus dev \ -Dgreeting="System property value"
Inspect the complete command that combines an environment variable with a higher-priority -D system property. section 3.2.3
