Chapter 7. Using configuration profiles

You can use different configuration profiles depending on your environment. Configuration profiles enable you to have multiple configurations in the same file and select between them using a profile name. Red Hat build of Quarkus has three configuration profiles. In addition, you can create your own custom profiles.

Quarkus default profiles:

  • dev: Activated in development mode
  • test: Activated when running tests
  • prod: The default profile when not running in development or test mode


  • You have a Quarkus Maven project.


  1. Open your Java resource file and add the following import statement:

    import io.quarkus.runtime.configuration.ProfileManager;
  2. To display the current configuration profile, add a log invoking the ProfileManager.getActiveProfile() method:

    LOGGER.infof("The application is starting with profile `%s`", ProfileManager.getActiveProfile());

    It is not possible to access the current profile using the @ConfigProperty("quarkus.profile") method.

7.1. Setting a custom configuration profile

You can create as many configuration profiles as you want. You can have multiple configurations in the same file and you can select between them using a profile name.


  1. To set a custom profile, create a configuration property with the profile name in the file, where <key> is the name of the property, <value> is the property value, and <profile> is the name of a profile:


    In the following example configuration, the value of quarkus.http.port is 9090 by default, and becomes 8181 when the dev profile is activated:

  2. Use one of the following methods to enable a profile:

    • Set the quarkus.profile system property.

      • To enable a profile using the quarkus.profile system property, enter the following command:

        mvn -D<key>=<value> quarkus:<profile>
    • Set the <quarkus_profile> environment variable.

      • To enable profile using an environment variable, enter the following command:

        export <quarkus_profile>=<profile>

        The system property value takes precedence over the environment variable value.

  3. To repackage the application and change the profile, enter the following command:

    ./mvnw package -Dquarkus.profile=<profile>
     java -jar target/myapp-runner.jar

    The following example shows a command that activates the prod-aws profile:

    ./mvnw package -Dquarkus.profile=prod-aws
     java -jar target/myapp-runner.jar

The default Quarkus application runtime profile is set to the profile used to build the application. Red Hat build of Quarkus automatically selects a profile depending on your environment mode. For example, when your application is running, Quarkus is in prod mode.