Interface ConfigBuilder
public interface ConfigBuilder
Builder for manually creating an instance of a
Config
.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionAdd the default config sources appearing on the builder's classpath including: System properties Environment properties /META-INF/microprofile-config.propertiesAdd the converters to be loaded via service loader patternAdd the config sources appearing to be loaded via service loader patternbuild()
Build theConfig
object.forClassLoader
(ClassLoader loader) Return the ConfigBuilder for a given classloaderwithConverters
(Converter<?>... converters) Add the specifiedConverter
.withSources
(ConfigSource... sources) Add the specifiedConfigSource
.
-
Method Details
-
addDefaultSources
ConfigBuilder addDefaultSources()Add the default config sources appearing on the builder's classpath including:- System properties
- Environment properties
- /META-INF/microprofile-config.properties
- Returns:
- the ConfigBuilder with the default config sources
-
addDiscoveredSources
ConfigBuilder addDiscoveredSources()Add the config sources appearing to be loaded via service loader pattern- Returns:
- the ConfigBuilder with the autodiscovered config sources
-
addDiscoveredConverters
ConfigBuilder addDiscoveredConverters()Add the converters to be loaded via service loader pattern- Returns:
- the ConfigBuilder with the autodiscovered converters
-
forClassLoader
Return the ConfigBuilder for a given classloader- Parameters:
loader
- the specified classloader- Returns:
- the ConfigureBuilder for the given classloader
-
withSources
Add the specifiedConfigSource
.- Parameters:
sources
- the config sources- Returns:
- the ConfigBuilder with the configured sources
-
withConverters
Add the specifiedConverter
. This method uses reflection to determine what type the converter is for. Custom converters should not be created as a lambda expression, as lambda expressions do not offer enough type information to the reflection API. Explicit implementation of a Converter interface is required for a custom converter.- Parameters:
converters
- the converters- Returns:
- the ConfigBuilder with the added converters
-
build
Config build()Build theConfig
object.- Returns:
- the Config object
-