Top Description Fields Constructors Methods
org.eclipse.microprofile.config.spi

public abstract Class ConfigProviderResolver

extends Object
Class Inheritance
Annotations
@ServiceConsumer:ConfigProviderResolver
effective:active
Imports
java.util.Iterator, .ServiceLoader, org.eclipse.microprofile.config.Config, aQute.bnd.annotation.spi.ServiceConsumer

The service provider for implementations of the MicroProfile Configuration specification.

This class is not intended to be used by end-users.

The implementation of this class should register itself via the java.util.ServiceLoader mechanism.

Authors
Mark Struberg, Romain Manni-Bucau, Emily Jiang

Field Summary

Modifier and TypeField and Description
private static volatile ConfigProviderResolver

Constructor Summary

AccessConstructor and Description
protected
ConfigProviderResolver()

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public abstract ConfigBuilder

Returns:

a new configuration builder instance
getBuilder
()

Create a ConfigBuilder instance for the current application.

public abstract Config

Returns:

the configuration instance
getConfig
()

Get the configuration instance for the current application in the manner described by org.eclipse.microprofile.config.ConfigProvider#getConfig().

public abstract Config

Returns:

the configuration instance
getConfig
(ClassLoader
the class loader identifying the application
loader
)

Get the configuration instance for the current application in the manner described by org.eclipse.microprofile.config.ConfigProvider#getConfig(ClassLoader).

public static ConfigProviderResolver

Returns:

the provider resolver instance
instance
()

Find and return the provider resolver instance.

private static ConfigProviderResolver
public abstract void
registerConfig(Config
the configuration to register
config
,
ClassLoader
the class loader identifying the application
classLoader
)

Register the given Config instance to the application identified by the given class loader.

public abstract void
releaseConfig(Config
the config to be released
config
)

A Config normally gets released if the Application it is associated with gets destroyed.

public static void
setInstance(ConfigProviderResolver
the instance to set, or null to unset the instance
resolver
)

Set the instance.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

instanceback to summary
private static volatile ConfigProviderResolver instance

Constructor Detail

ConfigProviderResolverback to summary
protected ConfigProviderResolver()

Construct a new instance.

Method Detail

getBuilderback to summary
public abstract ConfigBuilder getBuilder()

Create a ConfigBuilder instance for the current application.

The returned configuration builder must initially contain no registered configuration sources.

The returned configuration builder must initially contain only built in converters.

Returns:ConfigBuilder

a new configuration builder instance

getConfigback to summary
public abstract Config getConfig()

Get the configuration instance for the current application in the manner described by org.eclipse.microprofile.config.ConfigProvider#getConfig().

Returns:Config

the configuration instance

getConfigback to summary
public abstract Config getConfig(ClassLoader loader)

Get the configuration instance for the current application in the manner described by org.eclipse.microprofile.config.ConfigProvider#getConfig(ClassLoader).

Parameters
loader:ClassLoader

the class loader identifying the application

Returns:Config

the configuration instance

instanceback to summary
public static ConfigProviderResolver instance()

Find and return the provider resolver instance. If the provider resolver instance was already found, or was manually specified, that instance is returned. Otherwise, ServiceLoader is used to locate the first implementation that is visible from the class loader that defined this class.

Returns:ConfigProviderResolver

the provider resolver instance

loadSpiback to summary
private static ConfigProviderResolver loadSpi(ClassLoader cl)
registerConfigback to summary
public abstract void registerConfig(Config config, ClassLoader classLoader)

Register the given Config instance to the application identified by the given class loader. If the class loader is null, then the current application (as identified by the thread context class loader) will be used.

Parameters
config:Config

the configuration to register

classLoader:ClassLoader

the class loader identifying the application

Exceptions
IllegalStateException:
if there is already a configuration registered for the application
releaseConfigback to summary
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:Config

the config to be released

setInstanceback to summary
public static void setInstance(ConfigProviderResolver resolver)

Set the instance. It is used by OSGi environments that do not support the service loader pattern.

Note that calling this method after a different provider instance was already retrieved can lead to inconsistent results. Mixing usage of this method with the service loader pattern is for this reason strongly discouraged.

Parameters
resolver:ConfigProviderResolver

the instance to set, or null to unset the instance