Interface ConfigSourceProvider


public interface ConfigSourceProvider

Implement this interfaces to provide multiple ConfigSources. This is e.g. needed if there are multiple property files of a given name on the classpath but they are not all known at compile time.

If a single ConfigSource exists, then there is no need to register it using a custom implementation of ConfigSourceProvider, it can be registered directly as a ConfigSource.

A ConfigSourceProvider will get picked up via the ServiceLoader mechanism and can be registered by providing a META-INF/services/org.eclipse.microprofile.config.spi.ConfigSourceProvider file which contains the fully qualified classname of the custom ConfigSourceProvider.

  • Method Details

    • getConfigSources

      Iterable<ConfigSource> getConfigSources(ClassLoader forClassLoader)
      Return the collection of ConfigSources. For each e.g. property file, we return a single ConfigSource or an empty list if no ConfigSource exists.
      Parameters:
      forClassLoader - the classloader which should be used if any is needed
      Returns:
      the ConfigSources to register within the Config.