Java / Quarkus Interview questions
How do you configure a Quarkus application for different environments using profiles?
Environment-specific configuration in Quarkus is handled by combining the built-in dev, test, and prod profiles (or custom ones) with the %profile. property prefix, so one properties file can serve every environment without duplicating unrelated settings.
quarkus.datasource.db-kind=postgresql %dev.quarkus.datasource.username=dev_user %dev.quarkus.datasource.password=dev_pass %prod.quarkus.datasource.username=${DB_USER} %prod.quarkus.datasource.password=${DB_PASSWORD}
Unprefixed properties act as the default, applied unless a profile-specific value overrides them; this lets shared settings (like db-kind above) live in one place while only what actually differs per environment — credentials, hostnames, log levels — needs a profile prefix.
For production, teams typically avoid hardcoding secrets directly even under the %prod. prefix, instead referencing environment variables (as shown with ${DB_USER}) so actual credentials are injected at deploy time by the container platform rather than committed to source control, with the active profile itself controlled via the QUARKUS_PROFILE environment variable when a custom profile beyond the three built-in ones is needed.
More Related questions...