A configuration profile lets a Quarkus application use different property values at different lifecycle stages. The built-in profiles are `prod` for production mode, `dev` for Dev mode, and `test` for tests. This is useful when a test must connect to a different service or database from the one used in production. section 3.2.2
To configure a value for one profile:
- Prefix its property name in `application.properties` with `%`, the profile name, and a dot—for example, `%dev.quarkus.http.port=7777`. A separate file such as `application-dev.properties` is an alternative. section 3.2.2
- Quarkus prefers an active profile’s value, then an unprefixed value, then a default value if the application requires one. Additional user profiles can be activated with `quarkus.profile`. section 3.2.2
- Use `%test.` for settings needed only during tests. For example, `%test.mp.messaging.incoming.invoices-rabbitmq.queue.name=invoices` selects a RabbitMQ queue name in test mode. section 9.7.1
A configuration profile is not the same as a Quarkus test profile. Ordinary tests share an application instance and configuration. A test profile groups tests on an instance that Quarkus replaces when it runs another group. It can select a base configuration profile and override properties, as well as specify alternatives, test resources, tags, and—in applicable script tests—command-line parameters. The extra restarts increase suite runtime but allow different configurations and help separate tests whose state is difficult to clean up. section 5.4
Run a test against a staging service
Implement `QuarkusTestProfile` with `getConfigOverrides()` returning `Map.of("path.to.service", "http://staging.service.com")`, then annotate the test class with `@TestProfile(RunWithStaging.class)`. The profile can return `Set.of("staging")` from `tags()`; `quarkus.test.profile.tags` can filter a test run to matching tags. section 5.4
Do not confuse the `test` configuration profile with the Maven `native` profile. The former supplies application settings during tests; `./mvnw verify -Pnative` activates a build profile that builds a native binary and runs integration tests. In continuous testing, logs can confirm that the application activated the `test` profile. section 3.2.2 section 5.2.1 section 3.5.1
