diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 4428c604076c22..b206aeaece788f 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -51,7 +51,7 @@ 2.0 3.1.1 2.5.0 - 3.8.3 + 3.8.4-SNAPSHOT 4.1.0 4.0.0 3.10.0 diff --git a/core/deployment/src/main/java/io/quarkus/deployment/configuration/BuildTimeConfigurationReader.java b/core/deployment/src/main/java/io/quarkus/deployment/configuration/BuildTimeConfigurationReader.java index df01313ad3b534..e42d94cbb07b69 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/configuration/BuildTimeConfigurationReader.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/configuration/BuildTimeConfigurationReader.java @@ -9,10 +9,8 @@ import static io.quarkus.runtime.configuration.PropertiesUtil.isPropertyInRoots; import static io.smallrye.config.ConfigMappings.ConfigClassWithPrefix.configClassWithPrefix; import static io.smallrye.config.Expressions.withoutExpansion; -import static io.smallrye.config.PropertiesConfigSourceProvider.classPathSources; import static io.smallrye.config.SmallRyeConfig.SMALLRYE_CONFIG_PROFILE; import static io.smallrye.config.SmallRyeConfig.SMALLRYE_CONFIG_PROFILE_PARENT; -import static io.smallrye.config.SmallRyeConfigBuilder.META_INF_MICROPROFILE_CONFIG_PROPERTIES; import static java.util.stream.Collectors.toSet; import java.io.IOException; @@ -1125,8 +1123,7 @@ private SmallRyeConfig getConfigForRuntimeRecording() { builder.setAddDefaultSources(false) // Customizers may duplicate sources, but not much we can do about it, we need to run them .addDiscoveredCustomizers() - // Read microprofile-config.properties, because we disabled the default sources - .withSources(classPathSources(META_INF_MICROPROFILE_CONFIG_PROPERTIES, classLoader)); + .addPropertiesSources(); // TODO - Should we reset quarkus.config.location to not record from these sources? for (ConfigSource configSource : config.getConfigSources()) { diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java index 2d5ec46885b5e0..a1eeaeae115e9a 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java @@ -40,8 +40,6 @@ import io.quarkus.dev.testing.TestWatchedFiles; import io.quarkus.maven.dependency.ResolvedDependency; import io.quarkus.paths.PathList; -import io.quarkus.runtime.configuration.ApplicationPropertiesConfigSourceLoader; -import io.smallrye.config.DotEnvConfigSourceProvider; import io.smallrye.config.SmallRyeConfig; import io.smallrye.config.SmallRyeConfigBuilder; @@ -565,11 +563,7 @@ private void handleApplicationPropertiesChange() { } private static SmallRyeConfig getMinimalConfig() { - return new SmallRyeConfigBuilder() - .addDefaultSources() - .withSources(new ApplicationPropertiesConfigSourceLoader.InFileSystem()) - .withSources(new ApplicationPropertiesConfigSourceLoader.InClassPath()) - .withSources(new DotEnvConfigSourceProvider()).build(); + return new SmallRyeConfigBuilder().addDefaultSources().build(); } private Optional> getTrimmedListFromConfig(SmallRyeConfig updatedConfig, String property) { diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ApplicationPropertiesConfigSourceLoader.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ApplicationPropertiesConfigSourceLoader.java deleted file mode 100644 index 118662e7ac750c..00000000000000 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ApplicationPropertiesConfigSourceLoader.java +++ /dev/null @@ -1,52 +0,0 @@ -package io.quarkus.runtime.configuration; - -import java.io.IOException; -import java.net.URI; -import java.net.URL; -import java.nio.file.Paths; -import java.util.Collections; -import java.util.List; - -import org.eclipse.microprofile.config.spi.ConfigSource; -import org.eclipse.microprofile.config.spi.ConfigSourceProvider; - -import io.smallrye.config.AbstractLocationConfigSourceLoader; -import io.smallrye.config.PropertiesConfigSource; - -public class ApplicationPropertiesConfigSourceLoader extends AbstractLocationConfigSourceLoader { - @Override - protected String[] getFileExtensions() { - return new String[] { "properties" }; - } - - @Override - protected ConfigSource loadConfigSource(final URL url, final int ordinal) throws IOException { - return new PropertiesConfigSource(url, ordinal); - } - - public static class InClassPath extends ApplicationPropertiesConfigSourceLoader implements ConfigSourceProvider { - @Override - public List getConfigSources(final ClassLoader classLoader) { - return loadConfigSources("application.properties", 250, classLoader); - } - - @Override - protected List tryFileSystem(final URI uri, final int ordinal) { - return Collections.emptyList(); - } - } - - public static class InFileSystem extends ApplicationPropertiesConfigSourceLoader implements ConfigSourceProvider { - @Override - public List getConfigSources(final ClassLoader classLoader) { - return loadConfigSources( - Paths.get(System.getProperty("user.dir"), "config", "application.properties").toUri().toString(), 260, - classLoader); - } - - @Override - protected List tryClassPath(final URI uri, final int ordinal, final ClassLoader classLoader) { - return Collections.emptyList(); - } - } -} diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java index f91b643adf9e9d..016be508619052 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java @@ -17,7 +17,6 @@ import org.eclipse.microprofile.config.spi.ConfigSource; import io.quarkus.runtime.LaunchMode; -import io.smallrye.config.DotEnvConfigSourceProvider; import io.smallrye.config.SmallRyeConfig; import io.smallrye.config.SmallRyeConfigBuilder; @@ -81,10 +80,7 @@ public static SmallRyeConfigBuilder emptyConfigBuilder() { .addDefaultInterceptors() .addDiscoveredInterceptors() .addDiscoveredSecretKeysHandlers() - .addDefaultSources() - .withSources(new ApplicationPropertiesConfigSourceLoader.InFileSystem()) - .withSources(new ApplicationPropertiesConfigSourceLoader.InClassPath()) - .withSources(new DotEnvConfigSourceProvider()); + .addDefaultSources(); } public static List getProfiles() { diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/RuntimeConfigBuilder.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/RuntimeConfigBuilder.java index d20c66f8a36f9b..5415f6e4d521ca 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/RuntimeConfigBuilder.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/RuntimeConfigBuilder.java @@ -2,7 +2,6 @@ import java.util.UUID; -import io.smallrye.config.DotEnvConfigSourceProvider; import io.smallrye.config.SmallRyeConfigBuilder; import io.smallrye.config.SmallRyeConfigBuilderCustomizer; @@ -17,10 +16,7 @@ public void configBuilder(final SmallRyeConfigBuilder builder) { builder.forClassLoader(Thread.currentThread().getContextClassLoader()) .addDefaultInterceptors() - .addDefaultSources() - .withSources(new ApplicationPropertiesConfigSourceLoader.InFileSystem()) - .withSources(new ApplicationPropertiesConfigSourceLoader.InClassPath()) - .withSources(new DotEnvConfigSourceProvider()); + .addDefaultSources(); } @Override diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/StaticInitConfigBuilder.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/StaticInitConfigBuilder.java index d27c3bbb1e2e2e..a2bdbb63aef1de 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/StaticInitConfigBuilder.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/StaticInitConfigBuilder.java @@ -1,6 +1,5 @@ package io.quarkus.runtime.configuration; -import io.smallrye.config.DotEnvConfigSourceProvider; import io.smallrye.config.SmallRyeConfigBuilder; import io.smallrye.config.SmallRyeConfigBuilderCustomizer; @@ -14,10 +13,7 @@ public void configBuilder(final SmallRyeConfigBuilder builder) { builder.forClassLoader(Thread.currentThread().getContextClassLoader()) .addDefaultInterceptors() - .addDefaultSources() - .withSources(new ApplicationPropertiesConfigSourceLoader.InFileSystem()) - .withSources(new ApplicationPropertiesConfigSourceLoader.InClassPath()) - .withSources(new DotEnvConfigSourceProvider()); + .addDefaultSources(); } @Override diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/SystemOnlySourcesConfigBuilder.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/SystemOnlySourcesConfigBuilder.java index 34aa70b56f2be1..8dc7ebe18a9663 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/SystemOnlySourcesConfigBuilder.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/SystemOnlySourcesConfigBuilder.java @@ -5,6 +5,7 @@ public class SystemOnlySourcesConfigBuilder implements ConfigBuilder { @Override public SmallRyeConfigBuilder configBuilder(final SmallRyeConfigBuilder builder) { + // TODO - Adjust builder.getSourceProviders().clear(); return builder; } diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/EffectiveConfig.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/EffectiveConfig.java index 6e471bf99f8994..096f3e9f8670af 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/EffectiveConfig.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/EffectiveConfig.java @@ -1,12 +1,11 @@ package io.quarkus.gradle.tasks; -import static io.smallrye.config.SmallRyeConfigBuilder.META_INF_MICROPROFILE_CONFIG_PROPERTIES; -import static java.util.Collections.*; +import static java.util.Collections.emptyMap; +import static java.util.Collections.emptySet; +import static java.util.Collections.unmodifiableMap; import java.io.File; -import java.io.IOException; import java.net.MalformedURLException; -import java.net.URI; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; @@ -16,25 +15,17 @@ import java.util.Set; import java.util.function.Supplier; -import org.eclipse.microprofile.config.spi.ConfigSource; -import org.eclipse.microprofile.config.spi.ConfigSourceProvider; - import com.google.common.annotations.VisibleForTesting; import io.quarkus.deployment.configuration.ClassLoadingConfig; import io.quarkus.deployment.configuration.ConfigCompatibility; import io.quarkus.deployment.pkg.NativeConfig; import io.quarkus.deployment.pkg.PackageConfig; -import io.quarkus.runtime.configuration.ApplicationPropertiesConfigSourceLoader; import io.quarkus.runtime.configuration.ConfigUtils; -import io.smallrye.config.AbstractLocationConfigSourceLoader; -import io.smallrye.config.EnvConfigSource; import io.smallrye.config.Expressions; import io.smallrye.config.PropertiesConfigSource; -import io.smallrye.config.PropertiesConfigSourceProvider; import io.smallrye.config.SmallRyeConfig; -import io.smallrye.config.common.utils.ConfigSourceUtil; -import io.smallrye.config.source.yaml.YamlConfigSource; +import io.smallrye.config.source.yaml.YamlConfigSourceLoader; /** * Helper that bundles the various sources of config options for the Gradle plugin: system environment, system properties, @@ -50,56 +41,41 @@ public final class EffectiveConfig { private final Map values; private EffectiveConfig(Builder builder) { - List configSources = new ArrayList<>(); - // TODO add io.quarkus.runtime.configuration.DefaultsConfigSource ? - // TODO leverage io.quarkus.runtime.configuration.ProfileManager ? - // Effective "ordinals" for the config sources: // (see also https://quarkus.io/guides/config-reference#configuration-sources) // 600 -> forcedProperties // 500 -> taskProperties - // 400 -> System.getProperties() - // 300 -> System.getenv() + // 400 -> System.getProperties() (provided by default sources) + // 300 -> System.getenv() (provided by default sources) // 290 -> quarkusBuildProperties // 280 -> projectProperties - // 255 -> application,(yaml|yml) (in classpath/source) - // 250 -> application.properties (in classpath/source) - // 100 -> microprofile.properties (in classpath/source) + // 265 -> application.(yaml/yml) in config folder + // 260 -> application.properties in config folder (provided by default sources) + // 255 -> application.(yaml|yml) in classpath + // 250 -> application.properties in classpath (provided by default sources) + // 110 -> microprofile.(yaml|yml) in classpath + // 100 -> microprofile.properties in classpath (provided by default sources) // 0 -> fallback config source for error workaround (see below) - configSources.add(new PropertiesConfigSource(builder.forcedProperties, "forcedProperties", 600)); - configSources.add(new PropertiesConfigSource(asStringMap(builder.taskProperties), "taskProperties", 500)); - configSources.add(new PropertiesConfigSource(ConfigSourceUtil.propertiesToMap(System.getProperties()), - "System.getProperties()", 400)); - configSources.add(new EnvConfigSource(300) { - }); - configSources.add(new PropertiesConfigSource(builder.buildProperties, "quarkusBuildProperties", 290)); - configSources.add(new PropertiesConfigSource(asStringMap(builder.projectProperties), "projectProperties", 280)); - - ClassLoader classLoader = toUrlClassloader(builder.sourceDirectories); - ApplicationPropertiesConfigSourceLoader.InClassPath applicationProperties = new ApplicationPropertiesConfigSourceLoader.InClassPath(); - configSources.addAll(applicationProperties.getConfigSources(classLoader)); - ApplicationYamlConfigSourceLoader.InClassPath applicationYaml = new ApplicationYamlConfigSourceLoader.InClassPath(); - configSources.addAll(applicationYaml.getConfigSources(classLoader)); - configSources - .addAll(PropertiesConfigSourceProvider.classPathSources(META_INF_MICROPROFILE_CONFIG_PROPERTIES, classLoader)); - - // todo: this is due to ApplicationModel#getPlatformProperties not being included in the effective config - configSources.add(new PropertiesConfigSource(Map.of("platform.quarkus.native.builder-image", "<>"), - "NativeConfig#builderImage", 0)); - this.config = ConfigUtils.emptyConfigBuilder() - .setAddDiscoveredSecretKeysHandlers(false) - // We add our own sources for environment, system-properties and microprofile-config - // .properties, - // no need to include those twice. - .setAddDefaultSources(false) + .forClassLoader(toUrlClassloader(builder.sourceDirectories)) + .withSources(new PropertiesConfigSource(builder.forcedProperties, "forcedProperties", 600)) + .withSources(new PropertiesConfigSource(asStringMap(builder.taskProperties), "taskProperties", 500)) + .addSystemSources() + .withSources(new PropertiesConfigSource(builder.buildProperties, "quarkusBuildProperties", 290)) + .withSources(new PropertiesConfigSource(asStringMap(builder.projectProperties), "projectProperties", 280)) + .withSources(new YamlConfigSourceLoader.InFileSystem()) + .withSources(new YamlConfigSourceLoader.InClassPath()) + .addPropertiesSources() + // todo: this is due to ApplicationModel#getPlatformProperties not being included in the effective config + .withSources(new PropertiesConfigSource(Map.of("platform.quarkus.native.builder-image", "<>"), + "NativeConfig#builderImage", 0)) .withDefaultValues(builder.defaultProperties) - .withSources(configSources) .withProfile(builder.profile) .withMapping(PackageConfig.class) .withMapping(NativeConfig.class) .withInterceptors(ConfigCompatibility.FrontEnd.instance(), ConfigCompatibility.BackEnd.instance()) + .setAddDiscoveredSecretKeysHandlers(false) .build(); this.values = generateFullConfigMap(config); } @@ -203,35 +179,4 @@ private static ClassLoader toUrlClassloader(Set sourceDirectories) { } return new URLClassLoader(urls.toArray(new URL[0])); } - - // Copied from quarkus-config-yaml. May be replaced by adding the quarkus-config-yaml dependency - public static class ApplicationYamlConfigSourceLoader extends AbstractLocationConfigSourceLoader { - @Override - protected String[] getFileExtensions() { - return new String[] { - "yaml", - "yml" - }; - } - - @Override - protected ConfigSource loadConfigSource(final URL url, final int ordinal) throws IOException { - return new YamlConfigSource(url, ordinal); - } - - public static class InClassPath extends ApplicationYamlConfigSourceLoader implements ConfigSourceProvider { - @Override - public List getConfigSources(final ClassLoader classLoader) { - List configSources = new ArrayList<>(); - configSources.addAll(loadConfigSources("application.yaml", 255, classLoader)); - configSources.addAll(loadConfigSources("application.yml", 255, classLoader)); - return configSources; - } - - @Override - protected List tryFileSystem(final URI uri, final int ordinal) { - return new ArrayList<>(); - } - } - } } diff --git a/extensions/config-yaml/runtime/src/main/java/io/quarkus/config/yaml/runtime/AbstractYamlObjectConverter.java b/extensions/config-yaml/runtime/src/main/java/io/quarkus/config/yaml/runtime/AbstractYamlObjectConverter.java deleted file mode 100644 index 07d86d0076847d..00000000000000 --- a/extensions/config-yaml/runtime/src/main/java/io/quarkus/config/yaml/runtime/AbstractYamlObjectConverter.java +++ /dev/null @@ -1,48 +0,0 @@ -package io.quarkus.config.yaml.runtime; - -import java.util.Collections; -import java.util.Map; - -import org.eclipse.microprofile.config.spi.Converter; -import org.yaml.snakeyaml.introspector.Property; -import org.yaml.snakeyaml.introspector.PropertyUtils; - -/** - * This class is used by generated code to support the list of objects use case in {@code @ConfigProperties} - */ -@SuppressWarnings("unused") -public abstract class AbstractYamlObjectConverter implements Converter { - - protected abstract Class getClazz(); - - /** - * Contains names of fields that need to be converted from the value that MP-Config has set - * to the actual name of the field in the class - */ - protected Map getFieldNameMap() { - return Collections.emptyMap(); - } - - @Override - public T convert(String value) { - throw new UnsupportedOperationException( - "Mapping of YAML Configuration has been removed from io.quarkus.arc.config.ConfigProperties. Please use io.smallrye.config.ConfigMapping instead, which is a safer alternative."); - } - - private static class CustomPropertyUtils extends PropertyUtils { - - private final Map fieldNameMap; - - public CustomPropertyUtils(Map fieldNameMap) { - this.fieldNameMap = fieldNameMap; - } - - @Override - public Property getProperty(Class type, String name) { - if (fieldNameMap.containsKey(name)) { - name = fieldNameMap.get(name); - } - return super.getProperty(type, name); - } - } -} diff --git a/extensions/config-yaml/runtime/src/main/java/io/quarkus/config/yaml/runtime/ApplicationYamlConfigSourceLoader.java b/extensions/config-yaml/runtime/src/main/java/io/quarkus/config/yaml/runtime/ApplicationYamlConfigSourceLoader.java deleted file mode 100644 index 9badce0157191d..00000000000000 --- a/extensions/config-yaml/runtime/src/main/java/io/quarkus/config/yaml/runtime/ApplicationYamlConfigSourceLoader.java +++ /dev/null @@ -1,63 +0,0 @@ -package io.quarkus.config.yaml.runtime; - -import java.io.IOException; -import java.net.URI; -import java.net.URL; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.microprofile.config.spi.ConfigSource; -import org.eclipse.microprofile.config.spi.ConfigSourceProvider; - -import io.smallrye.config.AbstractLocationConfigSourceLoader; -import io.smallrye.config.source.yaml.YamlConfigSource; - -public class ApplicationYamlConfigSourceLoader extends AbstractLocationConfigSourceLoader { - @Override - protected String[] getFileExtensions() { - return new String[] { - "yaml", - "yml" - }; - } - - @Override - protected ConfigSource loadConfigSource(final URL url, final int ordinal) throws IOException { - return new YamlConfigSource(url, ordinal); - } - - public static class InClassPath extends ApplicationYamlConfigSourceLoader implements ConfigSourceProvider { - @Override - public List getConfigSources(final ClassLoader classLoader) { - List configSources = new ArrayList<>(); - configSources.addAll(loadConfigSources("application.yaml", 255, classLoader)); - configSources.addAll(loadConfigSources("application.yml", 255, classLoader)); - return configSources; - } - - @Override - protected List tryFileSystem(final URI uri, final int ordinal) { - return new ArrayList<>(); - } - } - - public static class InFileSystem extends ApplicationYamlConfigSourceLoader implements ConfigSourceProvider { - @Override - public List getConfigSources(final ClassLoader classLoader) { - List configSources = new ArrayList<>(); - configSources.addAll(loadConfigSources( - Paths.get(System.getProperty("user.dir"), "config", "application.yaml").toUri().toString(), 265, - classLoader)); - configSources.addAll( - loadConfigSources(Paths.get(System.getProperty("user.dir"), "config", "application.yml").toUri().toString(), - 265, classLoader)); - return configSources; - } - - @Override - protected List tryClassPath(final URI uri, final int ordinal, final ClassLoader classLoader) { - return new ArrayList<>(); - } - } -} diff --git a/extensions/config-yaml/runtime/src/main/java/io/quarkus/config/yaml/runtime/YamlConfigBuilder.java b/extensions/config-yaml/runtime/src/main/java/io/quarkus/config/yaml/runtime/YamlConfigBuilder.java index 9ed037ff36b7bd..0d2045b995f149 100644 --- a/extensions/config-yaml/runtime/src/main/java/io/quarkus/config/yaml/runtime/YamlConfigBuilder.java +++ b/extensions/config-yaml/runtime/src/main/java/io/quarkus/config/yaml/runtime/YamlConfigBuilder.java @@ -2,11 +2,12 @@ import io.quarkus.runtime.configuration.ConfigBuilder; import io.smallrye.config.SmallRyeConfigBuilder; +import io.smallrye.config.source.yaml.YamlConfigSourceLoader; public class YamlConfigBuilder implements ConfigBuilder { @Override public SmallRyeConfigBuilder configBuilder(final SmallRyeConfigBuilder builder) { - return builder.withSources(new ApplicationYamlConfigSourceLoader.InFileSystem()) - .withSources(new ApplicationYamlConfigSourceLoader.InClassPath()); + return builder.withSources(new YamlConfigSourceLoader.InFileSystem()) + .withSources(new YamlConfigSourceLoader.InClassPath()); } } diff --git a/extensions/config-yaml/runtime/src/main/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSourceProvider b/extensions/config-yaml/runtime/src/main/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSourceProvider deleted file mode 100644 index 67fab24d3e3544..00000000000000 --- a/extensions/config-yaml/runtime/src/main/resources/META-INF/services/org.eclipse.microprofile.config.spi.ConfigSourceProvider +++ /dev/null @@ -1,2 +0,0 @@ -io.quarkus.config.yaml.runtime.ApplicationYamlConfigSourceLoader$InFileSystem -io.quarkus.config.yaml.runtime.ApplicationYamlConfigSourceLoader$InClassPath diff --git a/extensions/picocli/runtime/src/main/java/io/quarkus/picocli/runtime/PicocliConfigBuilder.java b/extensions/picocli/runtime/src/main/java/io/quarkus/picocli/runtime/PicocliConfigBuilder.java deleted file mode 100644 index 8d900caa3022c0..00000000000000 --- a/extensions/picocli/runtime/src/main/java/io/quarkus/picocli/runtime/PicocliConfigBuilder.java +++ /dev/null @@ -1,34 +0,0 @@ -package io.quarkus.picocli.runtime; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.microprofile.config.spi.ConfigSourceProvider; - -import io.quarkus.runtime.configuration.ApplicationPropertiesConfigSourceLoader; -import io.quarkus.runtime.configuration.ConfigBuilder; -import io.smallrye.config.DotEnvConfigSourceProvider; -import io.smallrye.config.SmallRyeConfigBuilder; - -public class PicocliConfigBuilder implements ConfigBuilder { - @Override - public SmallRyeConfigBuilder configBuilder(final SmallRyeConfigBuilder builder) { - // Ideally we would create a new source builder, but it requires a lot of code to copy all required stuff, when we just want to remove a few sources - List originalProviders = new ArrayList<>(builder.getSourceProviders()); - for (ConfigSourceProvider originalProvider : originalProviders) { - if (originalProvider instanceof ApplicationPropertiesConfigSourceLoader.InClassPath) { - builder.getSourceProviders().remove(originalProvider); - } else if (originalProvider instanceof ApplicationPropertiesConfigSourceLoader.InFileSystem) { - builder.getSourceProviders().remove(originalProvider); - } else if (originalProvider instanceof DotEnvConfigSourceProvider) { - builder.getSourceProviders().remove(originalProvider); - } - } - return builder; - } - - @Override - public int priority() { - return Integer.MAX_VALUE; - } -} diff --git a/test-framework/junit5-component/src/main/java/io/quarkus/test/component/QuarkusComponentTestExtension.java b/test-framework/junit5-component/src/main/java/io/quarkus/test/component/QuarkusComponentTestExtension.java index 5896ee4f04115d..d7f0a5f9d26538 100644 --- a/test-framework/junit5-component/src/main/java/io/quarkus/test/component/QuarkusComponentTestExtension.java +++ b/test-framework/junit5-component/src/main/java/io/quarkus/test/component/QuarkusComponentTestExtension.java @@ -116,7 +116,6 @@ import io.quarkus.arc.processor.ResourceOutput; import io.quarkus.arc.processor.Types; import io.quarkus.bootstrap.classloading.QuarkusClassLoader; -import io.quarkus.runtime.configuration.ApplicationPropertiesConfigSourceLoader; import io.quarkus.test.InjectMock; import io.smallrye.config.ConfigMapping; import io.smallrye.config.ConfigMappings.ConfigClassWithPrefix; @@ -425,8 +424,6 @@ private void startContainer(ExtensionContext context, Lifecycle testInstanceLife .addDefaultInterceptors() .withConverters(configuration.configConverters.toArray(new Converter[] {})) .addDefaultSources() - .withSources(new ApplicationPropertiesConfigSourceLoader.InFileSystem()) - .withSources(new ApplicationPropertiesConfigSourceLoader.InClassPath()) .withSources( new QuarkusComponentTestConfigSource(configuration.configProperties, configuration.configSourceOrdinal));