Class ConfigProviderResolver
java.lang.Object
org.eclipse.microprofile.config.spi.ConfigProviderResolver
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ConfigBuilderCreate a freshConfigBuilderinstance.abstract Configabstract ConfiggetConfig(ClassLoader loader) static ConfigProviderResolverinstance()Creates a ConfigProviderResolver object Only used internally from withinConfigProviderabstract voidregisterConfig(Config config, ClassLoader classLoader) Register a givenConfigwithin the Application (or Module) identified by the given ClassLoader.abstract voidreleaseConfig(Config config) AConfignormally gets released if the Application it is associated with gets destroyed.static voidsetInstance(ConfigProviderResolver resolver) Set the instance.
-
Constructor Details
-
ConfigProviderResolver
protected ConfigProviderResolver()
-
-
Method Details
-
getConfig
- Returns:
- config the config object for the Thread Context Classloader
- See Also:
-
getConfig
- Parameters:
loader- the classloader- Returns:
- config the config object for the specified classloader
- See Also:
-
getBuilder
Create a freshConfigBuilderinstance. This ConfigBuilder will initially contain noConfigSource. The otherConfigSourcewill have to be added manually or discovered by callingConfigBuilder.addDiscoveredSources(). This ConfigBuilder will initially contain defaultConverters. Any other converters will need to be added manually. The ConfigProvider will not manage the Config instance internally- Returns:
- a fresh ConfigBuilder
-
registerConfig
Register a givenConfigwithin the Application (or Module) identified by the given ClassLoader. If the ClassLoader isnullthen the current Application will be used.- Parameters:
config- which should get registeredclassLoader- 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 usereleaseConfig(Config)for this case.
-
releaseConfig
AConfignormally 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
Creates a ConfigProviderResolver object Only used internally from withinConfigProvider- Returns:
- ConfigProviderResolver an instance of ConfigProviderResolver
-
setInstance
Set the instance. It is used by OSGi environment while service loader pattern is not supported.- Parameters:
resolver- set the instance.
-