Class ConfigProviderResolver

java.lang.Object
org.eclipse.microprofile.config.spi.ConfigProviderResolver

public abstract class ConfigProviderResolver extends Object
This class is not intended to be used by end-users but for portable container integration purpose only. Service provider for ConfigProviderResolver. The implementation registers itself via the ServiceLoader mechanism.
  • Constructor Details

    • ConfigProviderResolver

      protected ConfigProviderResolver()
  • Method Details

    • getConfig

      public abstract Config getConfig()
      Returns:
      config the config object for the Thread Context Classloader
      See Also:
    • getConfig

      public abstract Config getConfig(ClassLoader loader)
      Parameters:
      loader - the classloader
      Returns:
      config the config object for the specified classloader
      See Also:
    • getBuilder

      public abstract ConfigBuilder getBuilder()
      Create a fresh ConfigBuilder instance. This ConfigBuilder will initially contain no ConfigSource. The other ConfigSource will have to be added manually or discovered by calling ConfigBuilder.addDiscoveredSources(). This ConfigBuilder will initially contain default Converters. Any other converters will need to be added manually. The ConfigProvider will not manage the Config instance internally
      Returns:
      a fresh ConfigBuilder
    • registerConfig

      public abstract void registerConfig(Config config, ClassLoader classLoader)
      Register a given Config within the Application (or Module) identified by the given ClassLoader. If the ClassLoader is null then the current Application will be used.
      Parameters:
      config - which should get registered
      classLoader - which identifies the Application or Module the given Config should get associated with.
      Throws:
      IllegalStateException - if there is already a Config registered within the Application. A user could explicitly use releaseConfig(Config) for this case.
    • releaseConfig

      public abstract void releaseConfig(Config config)
      A Config normally gets released if the Application it is associated with gets destroyed. Invoke this method if you like to destroy the Config prematurely. If the given Config is associated within an Application then it will be unregistered.
      Parameters:
      config - the config to be released
    • instance

      public static ConfigProviderResolver instance()
      Creates a ConfigProviderResolver object Only used internally from within ConfigProvider
      Returns:
      ConfigProviderResolver an instance of ConfigProviderResolver
    • setInstance

      public static void setInstance(ConfigProviderResolver resolver)
      Set the instance. It is used by OSGi environment while service loader pattern is not supported.
      Parameters:
      resolver - set the instance.