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
-
Method Summary
Modifier and TypeMethodDescriptionabstract ConfigBuilder
Create a freshConfigBuilder
instance.abstract Config
abstract Config
getConfig
(ClassLoader loader) static ConfigProviderResolver
instance()
Creates a ConfigProviderResolver object Only used internally from withinConfigProvider
abstract void
registerConfig
(Config config, ClassLoader classLoader) Register a givenConfig
within the Application (or Module) identified by the given ClassLoader.abstract void
releaseConfig
(Config config) AConfig
normally gets released if the Application it is associated with gets destroyed.static void
setInstance
(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 freshConfigBuilder
instance. This ConfigBuilder will initially contain noConfigSource
. The otherConfigSource
will 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 givenConfig
within the Application (or Module) identified by the given ClassLoader. If the ClassLoader isnull
then 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
AConfig
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
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.
-