Class GlobalConfig

java.lang.Object
io.helidon.common.config.GlobalConfig

public final class GlobalConfig extends Object
Global configuration can be set by a user before any Helidon code is invoked, to override default discovery of configuration done by Helidon components.

If method config(java.util.function.Supplier) is called before Helidon is started, Helidon will only use that configuration.

You may still use custom instances of configuration when using configurable APIs directly.

  • Method Details

    • configured

      public static boolean configured()
      Whether a global configuration has already been configured.
      Returns:
      true if there is a global configuration set already, false otherwise
    • config

      public static Config config()
      Global configuration instance.
      Returns:
      Helidon shared configuration instance if configured, or an empty configuration if not
      See Also:
    • config

      public static Config config(Supplier<Config> config)
      Set global configuration if not yet configured.
      Parameters:
      config - configuration supplier to use if config is not yet configured
      Returns:
      used global configuration instance
    • config

      public static Config config(Supplier<Config> config, boolean overwrite)
      Set global configuration.
      Parameters:
      config - configuration to use
      overwrite - whether to overwrite an existing configured value
      Returns:
      current global config