Search in sources :

Example 1 with ConfigSourceProvider

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;
}
Also used : SystemPropertyConfigSource(fish.payara.nucleus.microprofile.config.source.SystemPropertyConfigSource) ServerConfigSource(fish.payara.nucleus.microprofile.config.source.ServerConfigSource) ConfigSource(org.eclipse.microprofile.config.spi.ConfigSource) ModuleConfigSource(fish.payara.nucleus.microprofile.config.source.ModuleConfigSource) ConfigConfigSource(fish.payara.nucleus.microprofile.config.source.ConfigConfigSource) EnvironmentConfigSource(fish.payara.nucleus.microprofile.config.source.EnvironmentConfigSource) SecretsDirConfigSource(fish.payara.nucleus.microprofile.config.source.SecretsDirConfigSource) ApplicationConfigSource(fish.payara.nucleus.microprofile.config.source.ApplicationConfigSource) ClusterConfigSource(fish.payara.nucleus.microprofile.config.source.ClusterConfigSource) JNDIConfigSource(fish.payara.nucleus.microprofile.config.source.JNDIConfigSource) PropertiesConfigSource(fish.payara.nucleus.microprofile.config.source.PropertiesConfigSource) DomainConfigSource(fish.payara.nucleus.microprofile.config.source.DomainConfigSource) ConfigSourceProvider(org.eclipse.microprofile.config.spi.ConfigSourceProvider)

Aggregations

ApplicationConfigSource (fish.payara.nucleus.microprofile.config.source.ApplicationConfigSource)1 ClusterConfigSource (fish.payara.nucleus.microprofile.config.source.ClusterConfigSource)1 ConfigConfigSource (fish.payara.nucleus.microprofile.config.source.ConfigConfigSource)1 DomainConfigSource (fish.payara.nucleus.microprofile.config.source.DomainConfigSource)1 EnvironmentConfigSource (fish.payara.nucleus.microprofile.config.source.EnvironmentConfigSource)1 JNDIConfigSource (fish.payara.nucleus.microprofile.config.source.JNDIConfigSource)1 ModuleConfigSource (fish.payara.nucleus.microprofile.config.source.ModuleConfigSource)1 PropertiesConfigSource (fish.payara.nucleus.microprofile.config.source.PropertiesConfigSource)1 SecretsDirConfigSource (fish.payara.nucleus.microprofile.config.source.SecretsDirConfigSource)1 ServerConfigSource (fish.payara.nucleus.microprofile.config.source.ServerConfigSource)1 SystemPropertyConfigSource (fish.payara.nucleus.microprofile.config.source.SystemPropertyConfigSource)1 ConfigSource (org.eclipse.microprofile.config.spi.ConfigSource)1 ConfigSourceProvider (org.eclipse.microprofile.config.spi.ConfigSourceProvider)1