public interface ConfigBuilder
Config
.ConfigProviderResolver.getBuilder()
Modifier and Type | Method and Description |
---|---|
ConfigBuilder |
addDefaultSources()
Add the default config sources appearing on the builder's classpath
including:
System properties
Environment properties
/META-INF/microprofile-config.properties
|
ConfigBuilder |
addDiscoveredConverters()
Add the converters to be loaded via service loader pattern
|
ConfigBuilder |
addDiscoveredSources()
Add the config sources appearing to be loaded via service loader pattern
|
Config |
build()
Build the
Config object. |
ConfigBuilder |
forClassLoader(java.lang.ClassLoader loader)
Return the ConfigBuilder for a given classloader
|
<T> ConfigBuilder |
withConverter(java.lang.Class<T> type,
int priority,
Converter<T> converter)
Add the specified
Converter for the given type. |
ConfigBuilder |
withConverters(Converter<?>... converters)
Add the specified
Converter . |
ConfigBuilder |
withSources(ConfigSource... sources)
Add the specified
ConfigSource . |
ConfigBuilder addDefaultSources()
ConfigBuilder addDiscoveredSources()
ConfigBuilder addDiscoveredConverters()
ConfigBuilder forClassLoader(java.lang.ClassLoader loader)
loader
- the specified classloaderConfigBuilder withSources(ConfigSource... sources)
ConfigSource
.sources
- the config sourcesConfigBuilder withConverters(Converter<?>... converters)
Converter
.
This method uses reflection to determine what type the converter is for.
When using lambda expressions for custom converters you should use
withConverter(Class, int, Converter)
and pass the target type explicitly
as lambda expressions do not offer enough type information to the reflection API.converters
- the converters<T> ConfigBuilder withConverter(java.lang.Class<T> type, int priority, Converter<T> converter)
Converter
for the given type.
This method does not rely on reflection to determine what type the converter is for
therefore also lambda expressions can be used.T
- the type to converttype
- the Class of type to convertpriority
- the priority of the converter (custom converters have a default priority of 100).converter
- the converter (can not be null
)