use of org.eclipse.microprofile.config.spi.ConfigSourceProvider in project Payara by payara.
the class ConfigProviderResolverImpl method getDiscoveredSources.
List<ConfigSource> getDiscoveredSources(ApplicationInfo appInfo) {
LinkedList<ConfigSource> sources = appInfo.getTransientAppMetaData(CUSTOM_SOURCES_KEY, LinkedList.class);
if (sources == null) {
sources = new LinkedList<>();
// resolve custom config sources
ServiceLoader<ConfigSource> serviceLoader = ServiceLoader.load(ConfigSource.class, appInfo.getAppClassLoader());
for (ConfigSource configSource : serviceLoader) {
sources.add(configSource);
}
//
ServiceLoader<ConfigSourceProvider> serviceProvideLoader = ServiceLoader.load(ConfigSourceProvider.class, appInfo.getAppClassLoader());
for (ConfigSourceProvider configSourceProvider : serviceProvideLoader) {
Iterable<ConfigSource> configSources = configSourceProvider.getConfigSources(appInfo.getAppClassLoader());
for (ConfigSource configSource : configSources) {
sources.add(configSource);
}
}
appInfo.addTransientAppMetaData(CUSTOM_SOURCES_KEY, sources);
}
return sources;
}
Aggregations