Search code examples
quarkus

How to determine programmatically the current active profiles in Quarkus


In the Quarkus Application Configuration Guide it mentions how to configure an app with profiles (eg. %dev.quarkus.http.port=8181).

But is there a way to access a Profile (or Environment) API so I can log the active profiles ? For example something like Spring:

@ApplicationScoped
public class ApplicationLifeCycle {

    private static final Logger LOGGER = LoggerFactory.getLogger("ApplicationLifeCycle");

    @Inject Environment env;

    void onStart(@Observes StartupEvent ev) {
        LOGGER.info("The application is starting with profiles " + env.getActiveProfiles());
    }

Solution

  • ProfileManager.getActiveProfile()?