From bf77189ef4b80e809e997e90ebae615504a0fd3d Mon Sep 17 00:00:00 2001 From: Roberto Cortez Date: Tue, 1 Aug 2023 20:16:45 +0100 Subject: [PATCH] Remove deprecated Config APIs --- .../quarkus/deployment/ExtensionLoader.java | 8 +- ...ootstrapConfigSourceProviderBuildItem.java | 28 --- ...BootstrapConfigSetupCompleteBuildItem.java | 10 - .../RunTimeConfigurationSourceBuildItem.java | 51 ----- ...TimeConfigurationSourceValueBuildItem.java | 29 --- ...taticInitConfigSourceFactoryBuildItem.java | 21 -- ...aticInitConfigSourceProviderBuildItem.java | 21 -- .../BuildTimeConfigurationReader.java | 59 +---- .../configuration/ConfigurationError.java | 8 - .../RunTimeConfigurationGenerator.java | 211 ++---------------- .../definition/RootDefinition.java | 10 - .../steps/BootstrapConfigSetupBuildStep.java | 48 ---- .../deployment/steps/ConfigBuildSteps.java | 53 ----- .../steps/ConfigDescriptionBuildStep.java | 2 - .../steps/ConfigGenerationBuildStep.java | 42 +--- .../steps/RuntimeConfigSetupBuildStep.java | 58 +---- .../runner/bootstrap/StartupActionImpl.java | 4 +- .../processor/generate_doc/ConfigPhase.java | 10 - .../runtime/annotations/ConfigPhase.java | 10 - .../runtime/configuration/ConfigUtils.java | 16 +- .../deployment/ResteasyReactiveProcessor.java | 4 +- .../bootstrap-config/application/pom.xml | 157 ------------- .../it/bootstrap/config/ConfigResource.java | 33 --- .../src/main/resources/application.properties | 3 - .../src/main/resources/config.properties | 1 - .../bootstrap/config/ConfigResourceTest.java | 53 ----- .../config/ConfigResourceTestIT.java | 7 - .../extension/deployment/pom.xml | 45 ---- .../DummyBootstrapConfigBuildStep.java | 35 --- .../bootstrap-config/extension/pom.xml | 24 -- .../extension/runtime/pom.xml | 43 ---- .../extension/DummyBootstrapRecorder.java | 13 -- .../extension/DummyBootstrapRecorder2.java | 22 -- .../config/extension/DummyConfig.java | 38 ---- .../config/extension/DummyConfigBuilder.java | 16 -- .../extension/DummyConfigSourceProvider.java | 29 --- integration-tests/bootstrap-config/pom.xml | 22 -- integration-tests/pom.xml | 3 +- 38 files changed, 27 insertions(+), 1220 deletions(-) delete mode 100644 core/deployment/src/main/java/io/quarkus/deployment/builditem/AdditionalBootstrapConfigSourceProviderBuildItem.java delete mode 100644 core/deployment/src/main/java/io/quarkus/deployment/builditem/BootstrapConfigSetupCompleteBuildItem.java delete mode 100644 core/deployment/src/main/java/io/quarkus/deployment/builditem/RunTimeConfigurationSourceBuildItem.java delete mode 100644 core/deployment/src/main/java/io/quarkus/deployment/builditem/RunTimeConfigurationSourceValueBuildItem.java delete mode 100644 core/deployment/src/main/java/io/quarkus/deployment/builditem/StaticInitConfigSourceFactoryBuildItem.java delete mode 100644 core/deployment/src/main/java/io/quarkus/deployment/builditem/StaticInitConfigSourceProviderBuildItem.java delete mode 100644 core/deployment/src/main/java/io/quarkus/deployment/configuration/ConfigurationError.java delete mode 100644 core/deployment/src/main/java/io/quarkus/deployment/steps/BootstrapConfigSetupBuildStep.java delete mode 100644 integration-tests/bootstrap-config/application/pom.xml delete mode 100644 integration-tests/bootstrap-config/application/src/main/java/io/quarkus/it/bootstrap/config/ConfigResource.java delete mode 100644 integration-tests/bootstrap-config/application/src/main/resources/application.properties delete mode 100644 integration-tests/bootstrap-config/application/src/main/resources/config.properties delete mode 100644 integration-tests/bootstrap-config/application/src/test/java/io/quarkus/it/bootstrap/config/ConfigResourceTest.java delete mode 100644 integration-tests/bootstrap-config/application/src/test/java/io/quarkus/it/bootstrap/config/ConfigResourceTestIT.java delete mode 100644 integration-tests/bootstrap-config/extension/deployment/pom.xml delete mode 100644 integration-tests/bootstrap-config/extension/deployment/src/main/java/io/quarkus/it/bootstrap/config/extension/deployment/DummyBootstrapConfigBuildStep.java delete mode 100644 integration-tests/bootstrap-config/extension/pom.xml delete mode 100644 integration-tests/bootstrap-config/extension/runtime/pom.xml delete mode 100644 integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyBootstrapRecorder.java delete mode 100644 integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyBootstrapRecorder2.java delete mode 100644 integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyConfig.java delete mode 100644 integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyConfigBuilder.java delete mode 100644 integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyConfigSourceProvider.java delete mode 100644 integration-tests/bootstrap-config/pom.xml diff --git a/core/deployment/src/main/java/io/quarkus/deployment/ExtensionLoader.java b/core/deployment/src/main/java/io/quarkus/deployment/ExtensionLoader.java index f4f21db395fab..b51b14c0481d2 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/ExtensionLoader.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/ExtensionLoader.java @@ -73,7 +73,6 @@ import io.quarkus.deployment.annotations.ProduceWeak; import io.quarkus.deployment.annotations.Record; import io.quarkus.deployment.annotations.Weak; -import io.quarkus.deployment.builditem.BootstrapConfigSetupCompleteBuildItem; import io.quarkus.deployment.builditem.BytecodeRecorderObjectLoaderBuildItem; import io.quarkus.deployment.builditem.ConfigurationBuildItem; import io.quarkus.deployment.builditem.MainBytecodeRecorderBuildItem; @@ -735,8 +734,7 @@ private static Consumer loadStepsFromClass(Class clazz, throw reportError(method, "Unsupported method return type " + returnType); } - if (methodConsumingConfigPhases.contains(ConfigPhase.BOOTSTRAP) - || methodConsumingConfigPhases.contains(ConfigPhase.RUN_TIME)) { + if (methodConsumingConfigPhases.contains(ConfigPhase.RUN_TIME)) { if (isRecorder && recordAnnotation.value() == ExecutionTime.STATIC_INIT) { throw reportError(method, "Bytecode recorder is static but an injected config object is declared as run time"); @@ -745,10 +743,6 @@ private static Consumer loadStepsFromClass(Class clazz, methodStepConfig = methodStepConfig .andThen(bsb -> bsb.consumes(RunTimeConfigurationProxyBuildItem.class)); - if (methodConsumingConfigPhases.contains(ConfigPhase.BOOTSTRAP)) { - methodStepConfig = methodStepConfig - .andThen(bsb -> bsb.afterProduce(BootstrapConfigSetupCompleteBuildItem.class)); - } if (methodConsumingConfigPhases.contains(ConfigPhase.RUN_TIME)) { methodStepConfig = methodStepConfig .andThen(bsb -> bsb.afterProduce(RuntimeConfigSetupCompleteBuildItem.class)); diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/AdditionalBootstrapConfigSourceProviderBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/AdditionalBootstrapConfigSourceProviderBuildItem.java deleted file mode 100644 index 4c549800fdf5d..0000000000000 --- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/AdditionalBootstrapConfigSourceProviderBuildItem.java +++ /dev/null @@ -1,28 +0,0 @@ -package io.quarkus.deployment.builditem; - -import org.eclipse.microprofile.config.spi.ConfigSourceProvider; - -import io.quarkus.builder.item.MultiBuildItem; - -/** - * Build item to use when an additional {@link ConfigSourceProvider} needs to be - * registered to the Bootstrap Config setup. - * This is needed because during Bootstrap Config setup, we don't auto-discover providers - * but we do want for example the YAML provider to be enabled. - * - * @deprecated Please use {@link RunTimeConfigBuilderBuildItem} and - * {@link io.smallrye.config.ConfigSourceFactory.ConfigurableConfigSourceFactory}. - */ -@Deprecated -public final class AdditionalBootstrapConfigSourceProviderBuildItem extends MultiBuildItem { - - private final String providerClassName; - - public AdditionalBootstrapConfigSourceProviderBuildItem(String providerClassName) { - this.providerClassName = providerClassName; - } - - public String getProviderClassName() { - return providerClassName; - } -} diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/BootstrapConfigSetupCompleteBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/BootstrapConfigSetupCompleteBuildItem.java deleted file mode 100644 index efa4034754376..0000000000000 --- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/BootstrapConfigSetupCompleteBuildItem.java +++ /dev/null @@ -1,10 +0,0 @@ -package io.quarkus.deployment.builditem; - -import io.quarkus.builder.item.EmptyBuildItem; - -/** - * Marker used by Build Steps that consume bootstrap configuration to ensure that they run after the bootstrap config has been - * set up. - */ -public final class BootstrapConfigSetupCompleteBuildItem extends EmptyBuildItem { -} diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/RunTimeConfigurationSourceBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/RunTimeConfigurationSourceBuildItem.java deleted file mode 100644 index 4811e0974bcaa..0000000000000 --- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/RunTimeConfigurationSourceBuildItem.java +++ /dev/null @@ -1,51 +0,0 @@ -package io.quarkus.deployment.builditem; - -import java.util.OptionalInt; - -import org.wildfly.common.Assert; - -import io.quarkus.builder.item.MultiBuildItem; - -/** - * Define an additional configuration source which is used at run time. - * - * @deprecated Please use {@link RunTimeConfigBuilderBuildItem} instead. - */ -@Deprecated -public final class RunTimeConfigurationSourceBuildItem extends MultiBuildItem { - private final String className; - private final OptionalInt priority; - - /** - * Construct a new instance. - * - * @param className the class name (must not be {@code null} or empty) - * @param priority an optional priority value to pass to the constructor (must not be {@code null}) - */ - public RunTimeConfigurationSourceBuildItem(final String className, final OptionalInt priority) { - Assert.checkNotNullParam("className", className); - Assert.checkNotEmptyParam("className", className); - Assert.checkNotNullParam("priority", priority); - this.className = className; - this.priority = priority; - } - - /** - * Get the class name. - * - * @return the class name (not {@code null} or empty) - */ - public String getClassName() { - return className; - } - - /** - * Get the priority. If present, the priority value will be passed into the constructor of the configuration source - * class; if absent, a no-arg constructor will be used. - * - * @return the priority (not {@code null}) - */ - public OptionalInt getPriority() { - return priority; - } -} diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/RunTimeConfigurationSourceValueBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/RunTimeConfigurationSourceValueBuildItem.java deleted file mode 100644 index 7ea6853025238..0000000000000 --- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/RunTimeConfigurationSourceValueBuildItem.java +++ /dev/null @@ -1,29 +0,0 @@ -package io.quarkus.deployment.builditem; - -import org.eclipse.microprofile.config.spi.ConfigSourceProvider; - -import io.quarkus.builder.item.MultiBuildItem; -import io.quarkus.runtime.RuntimeValue; - -/** - * This is a special build item that is intended to be used only to support bootstrap configuration in the following manner: - * - * A build step produces this BuildItem with a {@code RuntimeValue<ConfigSourceProvider>} a payload that is obtained by - * calling - * a ({@code RUNTIME_INIT}) recorder. - * The build step can optionally use a configuration object that uses the {@code BOOTSTRAP} config phase and pass this - * configuration to the recorder to allow the recorder at runtime to customize its behavior - */ -@Deprecated -public final class RunTimeConfigurationSourceValueBuildItem extends MultiBuildItem { - - private final RuntimeValue configSourcesValue; - - public RunTimeConfigurationSourceValueBuildItem(RuntimeValue configSourcesValue) { - this.configSourcesValue = configSourcesValue; - } - - public RuntimeValue getConfigSourcesValue() { - return configSourcesValue; - } -} diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/StaticInitConfigSourceFactoryBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/StaticInitConfigSourceFactoryBuildItem.java deleted file mode 100644 index a38b4de5c0472..0000000000000 --- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/StaticInitConfigSourceFactoryBuildItem.java +++ /dev/null @@ -1,21 +0,0 @@ -package io.quarkus.deployment.builditem; - -import io.quarkus.builder.item.MultiBuildItem; - -/** - * Provides a way to register a ConfigSourceFactory in STATIC INIT. - * - * @deprecated Please use {@link StaticInitConfigBuilderBuildItem} instead. - */ -@Deprecated -public final class StaticInitConfigSourceFactoryBuildItem extends MultiBuildItem { - private String factoryClassName; - - public StaticInitConfigSourceFactoryBuildItem(final String factoryClassName) { - this.factoryClassName = factoryClassName; - } - - public String getFactoryClassName() { - return factoryClassName; - } -} diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/StaticInitConfigSourceProviderBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/StaticInitConfigSourceProviderBuildItem.java deleted file mode 100644 index 2b18dc0aa9704..0000000000000 --- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/StaticInitConfigSourceProviderBuildItem.java +++ /dev/null @@ -1,21 +0,0 @@ -package io.quarkus.deployment.builditem; - -import io.quarkus.builder.item.MultiBuildItem; - -/** - * Provides a way to register a ConfigSourceProvider in STATIC INIT. - * - * @deprecated Please use {@link StaticInitConfigBuilderBuildItem} instead. - */ -@Deprecated -public final class StaticInitConfigSourceProviderBuildItem extends MultiBuildItem { - private final String providerClassName; - - public StaticInitConfigSourceProviderBuildItem(String providerClassName) { - this.providerClassName = providerClassName; - } - - public String getProviderClassName() { - return providerClassName; - } -} 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 da0354bcdbc78..b89cb87478bc6 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 @@ -109,13 +109,10 @@ private static List> collectConfigRoots(ClassLoader classLoader) throws final ConfigPatternMap buildTimePatternMap; final ConfigPatternMap buildTimeRunTimePatternMap; final ConfigPatternMap runTimePatternMap; - final ConfigPatternMap bootstrapPatternMap; final List allRoots; final List buildTimeVisibleRoots; - final boolean bootstrapRootsEmpty; - final List buildTimeMappings; final List buildTimeRunTimeMappings; final List runTimeMappings; @@ -153,7 +150,6 @@ private BuildTimeConfigurationReader(ClassLoader classLoader, final List buildTimeRoots = new ArrayList<>(); List buildTimeRunTimeRoots = new ArrayList<>(); List runTimeRoots = new ArrayList<>(); - List bootstrapRoots = new ArrayList<>(); buildTimeMappings = new ArrayList<>(); buildTimeRunTimeMappings = new ArrayList<>(); @@ -210,8 +206,6 @@ private BuildTimeConfigurationReader(ClassLoader classLoader, final List(buildTimeRoots.size() + buildTimeRunTimeRoots.size()); buildTimeVisibleRoots.addAll(buildTimeRoots); buildTimeVisibleRoots.addAll(buildTimeRunTimeRoots); - bootstrapRootsEmpty = bootstrapRoots.isEmpty(); - - allRoots = new ArrayList<>(buildTimeVisibleRoots.size() + bootstrapRoots.size() + runTimeRoots.size()); + allRoots = new ArrayList<>(buildTimeVisibleRoots.size() + runTimeRoots.size()); allRoots.addAll(buildTimeVisibleRoots); - allRoots.addAll(bootstrapRoots); allRoots.addAll(runTimeRoots); // ConfigMappings @@ -594,17 +584,6 @@ ReadResult run() { runTimeDefaultValues.put(configValue.getNameProfiled(), configValue.getValue()); } } - // also check for the bootstrap properties since those need to be added to runTimeDefaultValues as well - ni.goToStart(); - matched = bootstrapPatternMap.match(ni); - knownProperty = knownProperty || matched != null; - if (matched != null) { - // it's a run-time default (record for later) - ConfigValue configValue = withoutExpansion(() -> runtimeDefaultsConfig.getConfigValue(propertyName)); - if (configValue.getValue() != null) { - runTimeDefaultValues.put(configValue.getNameProfiled(), configValue.getValue()); - } - } if (!knownProperty) { unknownBuildProperties.add(propertyName); @@ -675,10 +654,8 @@ ReadResult run() { .setRunTimeDefaultValues(filterActiveProfileProperties(runTimeDefaultValues)) .setBuildTimePatternMap(buildTimePatternMap) .setBuildTimeRunTimePatternMap(buildTimeRunTimePatternMap) - .setBootstrapPatternMap(bootstrapPatternMap) .setRunTimePatternMap(runTimePatternMap) .setAllRoots(allRoots) - .setBootstrapRootsEmpty(bootstrapRootsEmpty) .setBuildTimeMappings(buildTimeMappings) .setBuildTimeRunTimeMappings(buildTimeRunTimeMappings) .setRunTimeMappings(runTimeMappings) @@ -1136,11 +1113,8 @@ public static final class ReadResult { final ConfigPatternMap buildTimePatternMap; final ConfigPatternMap buildTimeRunTimePatternMap; - final ConfigPatternMap bootstrapPatternMap; final ConfigPatternMap runTimePatternMap; - final boolean bootstrapRootsEmpty; - final List allRoots; final Map, RootDefinition> allRootsByClass; @@ -1161,11 +1135,8 @@ public ReadResult(final Builder builder) { this.buildTimePatternMap = builder.getBuildTimePatternMap(); this.buildTimeRunTimePatternMap = builder.getBuildTimeRunTimePatternMap(); - this.bootstrapPatternMap = builder.getBootstrapPatternMap(); this.runTimePatternMap = builder.getRunTimePatternMap(); - this.bootstrapRootsEmpty = builder.isBootstrapRootsEmpty(); - this.allRoots = builder.getAllRoots(); this.allRootsByClass = rootsToMap(builder); @@ -1224,18 +1195,10 @@ public ConfigPatternMap getBuildTimeRunTimePatternMap() { return buildTimeRunTimePatternMap; } - public ConfigPatternMap getBootstrapPatternMap() { - return bootstrapPatternMap; - } - public ConfigPatternMap getRunTimePatternMap() { return runTimePatternMap; } - public boolean isBootstrapRootsEmpty() { - return bootstrapRootsEmpty; - } - public List getAllRoots() { return allRoots; } @@ -1283,10 +1246,8 @@ static class Builder { private Map runTimeDefaultValues; private ConfigPatternMap buildTimePatternMap; private ConfigPatternMap buildTimeRunTimePatternMap; - private ConfigPatternMap bootstrapPatternMap; private ConfigPatternMap runTimePatternMap; private List allRoots; - private boolean bootstrapRootsEmpty; private List buildTimeMappings; private List buildTimeRunTimeMappings; private List runTimeMappings; @@ -1347,15 +1308,6 @@ Builder setBuildTimeRunTimePatternMap(final ConfigPatternMap buildTim return this; } - ConfigPatternMap getBootstrapPatternMap() { - return bootstrapPatternMap; - } - - Builder setBootstrapPatternMap(final ConfigPatternMap bootstrapPatternMap) { - this.bootstrapPatternMap = bootstrapPatternMap; - return this; - } - ConfigPatternMap getRunTimePatternMap() { return runTimePatternMap; } @@ -1374,15 +1326,6 @@ Builder setAllRoots(final List allRoots) { return this; } - boolean isBootstrapRootsEmpty() { - return bootstrapRootsEmpty; - } - - Builder setBootstrapRootsEmpty(final boolean bootstrapRootsEmpty) { - this.bootstrapRootsEmpty = bootstrapRootsEmpty; - return this; - } - List getBuildTimeMappings() { return buildTimeMappings; } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/configuration/ConfigurationError.java b/core/deployment/src/main/java/io/quarkus/deployment/configuration/ConfigurationError.java deleted file mode 100644 index 72059a9948fc4..0000000000000 --- a/core/deployment/src/main/java/io/quarkus/deployment/configuration/ConfigurationError.java +++ /dev/null @@ -1,8 +0,0 @@ -package io.quarkus.deployment.configuration; - -@Deprecated -public class ConfigurationError extends RuntimeException { - public ConfigurationError(final String message) { - super(message); - } -} diff --git a/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java b/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java index c032fce642b7b..a14c1d0c61470 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java @@ -1,7 +1,6 @@ package io.quarkus.deployment.configuration; import static io.quarkus.deployment.util.ReflectUtil.reportError; -import static io.quarkus.runtime.annotations.ConfigPhase.BOOTSTRAP; import static io.quarkus.runtime.annotations.ConfigPhase.BUILD_AND_RUN_TIME_FIXED; import static io.quarkus.runtime.annotations.ConfigPhase.RUN_TIME; @@ -87,26 +86,17 @@ public final class RunTimeConfigurationGenerator { public static final String CONFIG_CLASS_NAME = "io.quarkus.runtime.generated.Config"; - static final String BSDVCS_CLASS_NAME = "io.quarkus.runtime.generated.BootstrapDefaultValuesConfigSource"; static final String RTDVCS_CLASS_NAME = "io.quarkus.runtime.generated.RunTimeDefaultValuesConfigSource"; - // member descriptors - public static final FieldDescriptor C_INSTANCE = FieldDescriptor.of(CONFIG_CLASS_NAME, "INSTANCE", - CONFIG_CLASS_NAME); - public static final MethodDescriptor C_CREATE_BOOTSTRAP_CONFIG = MethodDescriptor.ofMethod(CONFIG_CLASS_NAME, - "createBootstrapConfig", CONFIG_CLASS_NAME); + public static final MethodDescriptor C_CREATE_RUN_TIME_CONFIG = MethodDescriptor.ofMethod(CONFIG_CLASS_NAME, + "createRunTimeConfig", void.class); public static final MethodDescriptor C_ENSURE_INITIALIZED = MethodDescriptor.ofMethod(CONFIG_CLASS_NAME, "ensureInitialized", void.class); - static final FieldDescriptor C_BOOTSTRAP_DEFAULTS_CONFIG_SOURCE = FieldDescriptor.of(CONFIG_CLASS_NAME, - "bootstrapDefaultsConfigSource", ConfigSource.class); static final FieldDescriptor C_RUN_TIME_DEFAULTS_CONFIG_SOURCE = FieldDescriptor.of(CONFIG_CLASS_NAME, "runTimeDefaultsConfigSource", ConfigSource.class); - static final MethodDescriptor C_BOOTSTRAP_CONFIG = MethodDescriptor.ofMethod(CONFIG_CLASS_NAME, "readBootstrapConfig", - void.class); public static final MethodDescriptor REINIT = MethodDescriptor.ofMethod(CONFIG_CLASS_NAME, "reinit", void.class); - public static final MethodDescriptor C_READ_CONFIG = MethodDescriptor.ofMethod(CONFIG_CLASS_NAME, "readConfig", void.class, - List.class); + public static final MethodDescriptor C_READ_CONFIG = MethodDescriptor.ofMethod(CONFIG_CLASS_NAME, "readConfig", void.class); static final FieldDescriptor C_UNKNOWN = FieldDescriptor.of(CONFIG_CLASS_NAME, "unknown", Set.class); static final FieldDescriptor C_UNKNOWN_RUNTIME = FieldDescriptor.of(CONFIG_CLASS_NAME, "unknownRuntime", Set.class); static final MethodDescriptor C_MAPPED_PROPERTIES = MethodDescriptor.ofMethod(CONFIG_CLASS_NAME, "mappedProperties", @@ -160,10 +150,6 @@ public final class RunTimeConfigurationGenerator { static final MethodDescriptor CU_CONFIG_BUILDER_WITH_ADD_DISCOVERED = MethodDescriptor.ofMethod(ConfigUtils.class, "configBuilder", SmallRyeConfigBuilder.class, boolean.class, boolean.class, LaunchMode.class); - static final MethodDescriptor CU_CONFIG_BUILDER_WITH_ADD_DISCOVERED_AND_BOOTSRAP = MethodDescriptor.ofMethod( - ConfigUtils.class, - "configBuilder", - SmallRyeConfigBuilder.class, boolean.class, boolean.class, boolean.class, LaunchMode.class); static final MethodDescriptor CU_CONFIG_BUILDER_LIST = MethodDescriptor.ofMethod(ConfigUtils.class, "configBuilder", SmallRyeConfigBuilder.class, SmallRyeConfigBuilder.class, List.class); static final MethodDescriptor CU_ADD_SOURCE_PROVIDER = MethodDescriptor.ofMethod(ConfigUtils.class, "addSourceProvider", @@ -223,7 +209,6 @@ public final class RunTimeConfigurationGenerator { static final MethodDescriptor QCF_SET_CONFIG = MethodDescriptor.ofMethod(QuarkusConfigFactory.class, "setConfig", void.class, SmallRyeConfig.class); - static final MethodDescriptor BSDVCS_NEW = MethodDescriptor.ofConstructor(BSDVCS_CLASS_NAME); static final MethodDescriptor RTDVCS_NEW = MethodDescriptor.ofConstructor(RTDVCS_CLASS_NAME); static final MethodDescriptor SRC_GET_CONVERTER = MethodDescriptor.ofMethod(SmallRyeConfig.class, "getConverter", @@ -269,8 +254,6 @@ public static final class GenerateOperation implements AutoCloseable { final MethodCreator clinit; final MethodCreator reinit; final BytecodeCreator converterSetup; - final MethodCreator readBootstrapConfig; - final ResultHandle readBootstrapConfigNameBuilder; final MethodCreator readConfig; final ResultHandle readConfigNameBuilder; final ResultHandle clinitNameBuilder; @@ -286,7 +269,6 @@ public static final class GenerateOperation implements AutoCloseable { final ResultHandle clinitConfig; final Map> convertersToRegister = new HashMap<>(); final List> additionalTypes; - final List additionalBootstrapConfigSourceProviders; final Set staticConfigSources; final Set staticConfigSourceProviders; final Set staticConfigSourceFactories; @@ -327,7 +309,6 @@ public static final class GenerateOperation implements AutoCloseable { classOutput = Assert.checkNotNullParam("classOutput", builder.getClassOutput()); roots = Assert.checkNotNullParam("builder.roots", builder.getBuildTimeReadResult().getAllRoots()); additionalTypes = Assert.checkNotNullParam("additionalTypes", builder.getAdditionalTypes()); - additionalBootstrapConfigSourceProviders = builder.getAdditionalBootstrapConfigSourceProviders(); staticConfigSources = builder.getStaticConfigSources(); staticConfigSourceProviders = builder.getStaticConfigSourceProviders(); staticConfigSourceFactories = builder.getStaticConfigSourceFactories(); @@ -366,17 +347,6 @@ public static final class GenerateOperation implements AutoCloseable { clinitNameBuilder = clinit.newInstance(SB_NEW); - // static field containing the instance of the class - is set when createBootstrapConfig is run - cc.getFieldCreator(C_INSTANCE) - .setModifiers(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_VOLATILE); - - // the bootstrap default values config source - if (!buildTimeReadResult.isBootstrapRootsEmpty()) { - cc.getFieldCreator(C_BOOTSTRAP_DEFAULTS_CONFIG_SOURCE) - .setModifiers(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL); - clinit.writeStaticField(C_BOOTSTRAP_DEFAULTS_CONFIG_SOURCE, clinit.newInstance(BSDVCS_NEW)); - } - // the run time default values config source cc.getFieldCreator(C_RUN_TIME_DEFAULTS_CONFIG_SOURCE) .setModifiers(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL); @@ -415,15 +385,6 @@ public static final class GenerateOperation implements AutoCloseable { // block for converter setup converterSetup = clinit.createScope(); - // create readBootstrapConfig method - this will always exist whether or not it contains a method body - // the method body will be empty when there are no bootstrap configuration roots - readBootstrapConfig = cc.getMethodCreator(C_BOOTSTRAP_CONFIG); - if (buildTimeReadResult.isBootstrapRootsEmpty()) { - readBootstrapConfigNameBuilder = null; - } else { - readBootstrapConfigNameBuilder = readBootstrapConfig.newInstance(SB_NEW); - } - // create readConfig readConfig = cc.getMethodCreator(C_READ_CONFIG); // the readConfig name builder @@ -432,11 +393,6 @@ public static final class GenerateOperation implements AutoCloseable { accessorFinder = new AccessorFinder(); } - // meant to be called in outside the constructor - private boolean bootstrapConfigSetupNeeded() { - return readBootstrapConfigNameBuilder != null; - } - public void run() { // in clinit, load the build-time config // make the build time config global until we read the run time config - @@ -484,92 +440,30 @@ public void run() { final ConfigPatternMap buildTimePatternMap = buildTimeConfigResult.getBuildTimePatternMap(); final ConfigPatternMap buildTimeRunTimePatternMap = buildTimeConfigResult .getBuildTimeRunTimePatternMap(); - final ConfigPatternMap bootstrapPatternMap = buildTimeConfigResult.getBootstrapPatternMap(); final ConfigPatternMap runTimePatternMap = buildTimeConfigResult.getRunTimePatternMap(); final BiFunction combinator = (a, b) -> a == null ? b : a; - final ConfigPatternMap buildTimeRunTimeIgnored = ConfigPatternMap - .merge(ConfigPatternMap.merge(buildTimePatternMap, - runTimePatternMap, combinator), bootstrapPatternMap, combinator); - final ConfigPatternMap runTimeIgnored = ConfigPatternMap - .merge(ConfigPatternMap.merge(buildTimePatternMap, - buildTimeRunTimePatternMap, combinator), bootstrapPatternMap, combinator); - final ConfigPatternMap bootstrapIgnored = ConfigPatternMap - .merge(ConfigPatternMap.merge(buildTimePatternMap, - buildTimeRunTimePatternMap, combinator), runTimePatternMap, combinator); + final ConfigPatternMap buildTimeRunTimeIgnored = ConfigPatternMap.merge(buildTimePatternMap, + runTimePatternMap, combinator); + final ConfigPatternMap runTimeIgnored = ConfigPatternMap.merge(buildTimePatternMap, + buildTimeRunTimePatternMap, combinator); final MethodDescriptor siParserBody = generateParserBody(buildTimeRunTimePatternMap, buildTimeRunTimeIgnored, new StringBuilder("siParseKey"), false, Type.BUILD_TIME); final MethodDescriptor rtParserBody = generateParserBody(runTimePatternMap, runTimeIgnored, new StringBuilder("rtParseKey"), false, Type.RUNTIME); - MethodDescriptor bsParserBody = null; - if (bootstrapConfigSetupNeeded()) { - bsParserBody = generateParserBody(bootstrapPatternMap, bootstrapIgnored, - new StringBuilder("bsParseKey"), false, Type.BOOTSTRAP); - } - - // create the bootstrap config if necessary - ResultHandle bootstrapBuilder = null; - if (bootstrapConfigSetupNeeded()) { - bootstrapBuilder = readBootstrapConfig.invokeStaticMethod(CU_CONFIG_BUILDER_WITH_ADD_DISCOVERED_AND_BOOTSRAP, - readBootstrapConfig.load(true), readBootstrapConfig.load(true), readBootstrapConfig.load(false), - readBootstrapConfig.load(launchMode)); - } // create the run time config final ResultHandle runTimeBuilder = readConfig.invokeStaticMethod( - CU_CONFIG_BUILDER_WITH_ADD_DISCOVERED_AND_BOOTSRAP, readConfig.load(true), readConfig.load(false), + CU_CONFIG_BUILDER_WITH_ADD_DISCOVERED, readConfig.load(true), readConfig.load(false), readConfig.load(launchMode)); - // add in our run time only config source provider - readConfig.invokeStaticMethod(CU_ADD_SOURCE_PROVIDER, runTimeBuilder, readConfig.newInstance( - MethodDescriptor.ofConstructor("io.quarkus.runtime.generated.ConfigSourceProviderImpl"))); - - // add in the custom sources that bootstrap config needs - ResultHandle bootstrapConfigSourcesArray = null; - if (bootstrapConfigSetupNeeded()) { - bootstrapConfigSourcesArray = readBootstrapConfig.newArray(ConfigSource[].class, 1); - // bootstrap config default values - readBootstrapConfig.writeArrayValue(bootstrapConfigSourcesArray, 0, - readBootstrapConfig.readStaticField(C_BOOTSTRAP_DEFAULTS_CONFIG_SOURCE)); - - // add bootstrap safe static sources - for (String bootstrapConfigSource : staticConfigSources) { - readBootstrapConfig.invokeStaticMethod(CU_ADD_SOURCE_PROVIDER, bootstrapBuilder, - readBootstrapConfig.newInstance(RCS_NEW, readBootstrapConfig.load(bootstrapConfigSource))); - } - // add bootstrap safe static source providers - for (String bootstrapConfigSourceProvider : staticConfigSourceProviders) { - readBootstrapConfig.invokeStaticMethod(CU_ADD_SOURCE_PROVIDER, bootstrapBuilder, - readBootstrapConfig.newInstance(RCSP_NEW, readBootstrapConfig.load(bootstrapConfigSourceProvider))); - } - // add bootstrap safe static source factories - for (String discoveredConfigSourceFactory : staticConfigSourceFactories) { - readBootstrapConfig.invokeStaticMethod(CU_ADD_SOURCE_FACTORY_PROVIDER, bootstrapBuilder, - readBootstrapConfig.newInstance(RCSF_NEW, readBootstrapConfig.load(discoveredConfigSourceFactory))); - } - - // add bootstrap config builders - ResultHandle bootstrapConfigBuilders = readBootstrapConfig.newInstance(AL_NEW); - for (String configBuilder : staticConfigBuilders) { - readBootstrapConfig.invokeVirtualMethod(AL_ADD, bootstrapConfigBuilders, - readBootstrapConfig.load(configBuilder)); - } - readBootstrapConfig.invokeStaticMethod(CU_CONFIG_BUILDER_LIST, bootstrapBuilder, bootstrapConfigBuilders); - } - // add in our custom sources - final ResultHandle runtimeConfigSourcesArray = readConfig.newArray(ConfigSource[].class, - bootstrapConfigSetupNeeded() ? 2 : 1); + final ResultHandle runtimeConfigSourcesArray = readConfig.newArray(ConfigSource[].class, 1); // run time config default values readConfig.writeArrayValue(runtimeConfigSourcesArray, 0, readConfig.readStaticField(C_RUN_TIME_DEFAULTS_CONFIG_SOURCE)); - if (bootstrapConfigSetupNeeded()) { - // bootstrap config default values - readConfig.writeArrayValue(runtimeConfigSourcesArray, 1, - readConfig.readStaticField(C_BOOTSTRAP_DEFAULTS_CONFIG_SOURCE)); - } // add in known converters for (Class additionalType : additionalTypes) { @@ -591,34 +485,14 @@ public void run() { for (Map.Entry> entry : convertersToRegister.entrySet()) { final FieldDescriptor descriptor = entry.getKey(); final Class type = entry.getValue(); - if (bootstrapConfigSetupNeeded()) { - readBootstrapConfig.invokeVirtualMethod(SRCB_WITH_CONVERTER, bootstrapBuilder, - readBootstrapConfig.loadClassFromTCCL(type), - readBootstrapConfig.load(100), readBootstrapConfig.readStaticField(descriptor)); - } readConfig.invokeVirtualMethod(SRCB_WITH_CONVERTER, runTimeBuilder, readConfig.loadClassFromTCCL(type), readConfig.load(100), readConfig.readStaticField(descriptor)); } } - // put sources in the bootstrap builder - if (bootstrapConfigSetupNeeded()) { - readBootstrapConfig.invokeVirtualMethod(SRCB_WITH_SOURCES, bootstrapBuilder, bootstrapConfigSourcesArray); - - // add additional providers - for (String providerClass : additionalBootstrapConfigSourceProviders) { - ResultHandle providerInstance = readBootstrapConfig - .newInstance(MethodDescriptor.ofConstructor(providerClass)); - readBootstrapConfig.invokeStaticMethod(CU_ADD_SOURCE_PROVIDER, bootstrapBuilder, providerInstance); - } - } // put sources in the builder readConfig.invokeVirtualMethod(SRCB_WITH_SOURCES, runTimeBuilder, runtimeConfigSourcesArray); - // add the ConfigSourceProvider List passed as the readConfig method param - // (which were generated by the bootstrap config phase - an empty list is passed when there is no bootstrap phase) - readConfig.invokeStaticMethod(CU_ADD_SOURCE_PROVIDERS, runTimeBuilder, readConfig.getMethodParam(0)); - // add discovered sources for (String runtimeConfigSource : runtimeConfigSources) { readConfig.invokeStaticMethod(CU_ADD_SOURCE_PROVIDER, runTimeBuilder, @@ -644,20 +518,10 @@ public void run() { } readConfig.invokeStaticMethod(CU_CONFIG_BUILDER_LIST, runTimeBuilder, configBuilders); - ResultHandle bootstrapConfig = null; - if (bootstrapConfigSetupNeeded()) { - bootstrapConfig = readBootstrapConfig.invokeVirtualMethod(SRCB_BUILD, bootstrapBuilder); - installConfiguration(bootstrapConfig, readBootstrapConfig); - } - final ResultHandle runTimeConfig = readConfig.invokeVirtualMethod(SRCB_BUILD, runTimeBuilder); installConfiguration(runTimeConfig, readConfig); final ResultHandle clInitOldLen = clinit.invokeVirtualMethod(SB_LENGTH, clinitNameBuilder); - ResultHandle bcOldLen = null; - if (bootstrapConfigSetupNeeded()) { - bcOldLen = readBootstrapConfig.invokeVirtualMethod(SB_LENGTH, readBootstrapConfigNameBuilder); - } final ResultHandle rcOldLen = readConfig.invokeVirtualMethod(SB_LENGTH, readConfigNameBuilder); // generate eager config read (both build and run time at once) @@ -707,28 +571,6 @@ public void run() { readConfig.invokeStaticMethod(initGroup, runTimeConfig, readConfigNameBuilder, instance); readConfig.invokeVirtualMethod(SB_SET_LENGTH, readConfigNameBuilder, rcOldLen); } - } else if (root.getConfigPhase() == ConfigPhase.BOOTSTRAP) { - if (bootstrapConfigSetupNeeded()) { - // config root field is volatile; we initialize and read config from the readBootstrapConfig method - cc.getFieldCreator(rootFieldDescriptor) - .setModifiers(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_VOLATILE); - - // construct instance in readBootstrapConfig - final ResultHandle instance; - if (accessorCtor == null) { - instance = readBootstrapConfig.newInstance(MethodDescriptor.ofConstructor(configurationClass)); - } else { - instance = readBootstrapConfig.invokeStaticMethod(accessorCtor); - } - - // assign instance to field - readBootstrapConfig.writeStaticField(rootFieldDescriptor, instance); - readBootstrapConfig.invokeVirtualMethod(SB_APPEND_STRING, readBootstrapConfigNameBuilder, - readBootstrapConfig.load(root.getName())); - readBootstrapConfig.invokeStaticMethod(initGroup, bootstrapConfig, readBootstrapConfigNameBuilder, - instance); - readBootstrapConfig.invokeVirtualMethod(SB_SET_LENGTH, readBootstrapConfigNameBuilder, bcOldLen); - } } else if (root.getConfigPhase() == ConfigPhase.RUN_TIME) { // config root field is volatile; we initialize and read config from the readConfig method cc.getFieldCreator(rootFieldDescriptor) @@ -772,12 +614,6 @@ public void run() { readConfig.invokeStaticMethod(C_MAPPED_PROPERTIES)); readConfig.invokeStaticMethod(CD_UNKNOWN_PROPERTIES_RT, readConfig.readStaticField(C_UNKNOWN_RUNTIME)); - if (bootstrapConfigSetupNeeded()) { - // generate sweep for bootstrap config - configSweepLoop(bsParserBody, readBootstrapConfig, bootstrapConfig, getRegisteredRoots(BOOTSTRAP), - Type.BOOTSTRAP); - } - // generate ensure-initialized method // the point of this method is simply to initialize the Config class // thus initializing the config infrastructure before anything requests it @@ -786,13 +622,12 @@ public void run() { mc.returnValue(null); } - // generate bootstrap config entry point - try (MethodCreator mc = cc.getMethodCreator(C_CREATE_BOOTSTRAP_CONFIG)) { + // generate run time entry point + try (MethodCreator mc = cc.getMethodCreator(C_CREATE_RUN_TIME_CONFIG)) { mc.setModifiers(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC); ResultHandle instance = mc.newInstance(MethodDescriptor.ofConstructor(CONFIG_CLASS_NAME)); - mc.writeStaticField(C_INSTANCE, instance); - mc.invokeVirtualMethod(C_BOOTSTRAP_CONFIG, instance); - mc.returnValue(instance); + mc.invokeVirtualMethod(C_READ_CONFIG, instance); + mc.returnValue(null); } // wrap it up @@ -820,9 +655,6 @@ public void run() { configurationException, emptyStackTraceElement); isError.throwException(configurationException); - readBootstrapConfig.returnValue(null); - readBootstrapConfig.close(); - readConfig.returnValue(null); readConfig.close(); @@ -830,11 +662,6 @@ public void run() { clinit.close(); cc.close(); - if (bootstrapConfigSetupNeeded()) { - // generate bootstrap default values config source class - generateDefaultValuesConfigSourceClass(bootstrapPatternMap, BSDVCS_CLASS_NAME); - } - // generate run time default values config source class generateDefaultValuesConfigSourceClass(runTimePatternMap, RTDVCS_CLASS_NAME); } @@ -1735,8 +1562,6 @@ public static final class Builder { private ClassOutput classOutput; private BuildTimeConfigurationReader.ReadResult buildTimeReadResult; private List> additionalTypes; - private List additionalBootstrapConfigSourceProviders; - private Set staticConfigSources; private Set staticConfigSourceProviders; private Set staticConfigSourceFactories; @@ -1793,15 +1618,6 @@ public Builder setLaunchMode(LaunchMode launchMode) { return this; } - List getAdditionalBootstrapConfigSourceProviders() { - return additionalBootstrapConfigSourceProviders; - } - - public Builder setAdditionalBootstrapConfigSourceProviders(List additionalBootstrapConfigSourceProviders) { - this.additionalBootstrapConfigSourceProviders = additionalBootstrapConfigSourceProviders; - return this; - } - Set getStaticConfigSources() { return staticConfigSources; } @@ -1912,7 +1728,6 @@ private static boolean isFieldEligibleForDirectAccess(ClassDefinition.ClassMembe private enum Type { BUILD_TIME("si"), - BOOTSTRAP("bs"), RUNTIME("rt"); final String methodPrefix; diff --git a/core/deployment/src/main/java/io/quarkus/deployment/configuration/definition/RootDefinition.java b/core/deployment/src/main/java/io/quarkus/deployment/configuration/definition/RootDefinition.java index 0a8c8c8559728..bd0122ab96e69 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/configuration/definition/RootDefinition.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/configuration/definition/RootDefinition.java @@ -46,16 +46,6 @@ public final class RootDefinition extends ClassDefinition { "Run", "Time", "Config"), "Configuration"), "Config"); - } else if (configPhase == ConfigPhase.BOOTSTRAP) { - trimmedSegments = withoutSuffix( - withoutSuffix( - withoutSuffix( - withoutSuffix( - segments, - "Bootstrap", "Configuration"), - "Bootstrap", "Config"), - "Configuration"), - "Config"); } else { trimmedSegments = withoutSuffix( withoutSuffix( diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/BootstrapConfigSetupBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/BootstrapConfigSetupBuildStep.java deleted file mode 100644 index dbf031e33d1a8..0000000000000 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/BootstrapConfigSetupBuildStep.java +++ /dev/null @@ -1,48 +0,0 @@ -package io.quarkus.deployment.steps; - -import static io.quarkus.deployment.configuration.RunTimeConfigurationGenerator.C_CREATE_BOOTSTRAP_CONFIG; -import static io.quarkus.gizmo.MethodDescriptor.ofMethod; - -import io.quarkus.deployment.GeneratedClassGizmoAdaptor; -import io.quarkus.deployment.annotations.BuildProducer; -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.annotations.Produce; -import io.quarkus.deployment.builditem.BootstrapConfigSetupCompleteBuildItem; -import io.quarkus.deployment.builditem.GeneratedClassBuildItem; -import io.quarkus.deployment.builditem.MainBytecodeRecorderBuildItem; -import io.quarkus.gizmo.ClassCreator; -import io.quarkus.gizmo.ClassOutput; -import io.quarkus.gizmo.MethodCreator; -import io.quarkus.runtime.StartupContext; -import io.quarkus.runtime.StartupTask; - -public class BootstrapConfigSetupBuildStep { - - private static final String BOOTSTRAP_CONFIG_STARTUP_TASK_CLASS_NAME = "io.quarkus.deployment.steps.BootstrapConfigSetup"; - - /** - * Generates a StartupTask that creates an instance of the generated Config class - * It runs before any StartupTask that uses configuration - */ - @BuildStep - @Produce(BootstrapConfigSetupCompleteBuildItem.class) - void setupBootstrapConfig(BuildProducer generatedClass, - BuildProducer mainBytecodeRecorder) { - ClassOutput classOutput = new GeneratedClassGizmoAdaptor(generatedClass, true); - - try (ClassCreator clazz = ClassCreator.builder().classOutput(classOutput) - .className(BOOTSTRAP_CONFIG_STARTUP_TASK_CLASS_NAME) - .interfaces(StartupTask.class).build()) { - - try (MethodCreator deploy = clazz.getMethodCreator("deploy", void.class, StartupContext.class)) { - deploy.invokeVirtualMethod(ofMethod(StartupContext.class, "setCurrentBuildStepName", void.class, String.class), - deploy.getMethodParam(0), deploy.load("BootstrapConfigSetupBuildStep.setupBootstrapConfig")); - - deploy.invokeStaticMethod(C_CREATE_BOOTSTRAP_CONFIG); - deploy.returnValue(null); - } - } - - mainBytecodeRecorder.produce(new MainBytecodeRecorderBuildItem(BOOTSTRAP_CONFIG_STARTUP_TASK_CLASS_NAME)); - } -} diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigBuildSteps.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigBuildSteps.java index a3bdf3071a2c9..478b4b9d13ff4 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigBuildSteps.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigBuildSteps.java @@ -2,33 +2,20 @@ import java.io.IOException; import java.util.Arrays; -import java.util.List; -import java.util.OptionalInt; import java.util.Set; import java.util.function.BooleanSupplier; import org.eclipse.microprofile.config.spi.ConfigProviderResolver; -import org.eclipse.microprofile.config.spi.ConfigSource; -import org.eclipse.microprofile.config.spi.ConfigSourceProvider; import org.eclipse.microprofile.config.spi.Converter; import io.quarkus.deployment.ConfigBuildTimeConfig; -import io.quarkus.deployment.GeneratedClassGizmoAdaptor; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.builditem.GeneratedClassBuildItem; -import io.quarkus.deployment.builditem.LiveReloadBuildItem; import io.quarkus.deployment.builditem.RunTimeConfigBuilderBuildItem; -import io.quarkus.deployment.builditem.RunTimeConfigurationSourceBuildItem; import io.quarkus.deployment.builditem.StaticInitConfigBuilderBuildItem; import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; import io.quarkus.deployment.util.ServiceUtil; -import io.quarkus.gizmo.ClassCreator; -import io.quarkus.gizmo.ClassOutput; -import io.quarkus.gizmo.MethodCreator; -import io.quarkus.gizmo.MethodDescriptor; -import io.quarkus.gizmo.ResultHandle; import io.quarkus.runtime.configuration.SystemOnlySourcesConfigBuilder; import io.quarkus.runtime.graal.InetRunTime; import io.smallrye.config.ConfigSourceInterceptor; @@ -39,48 +26,8 @@ import io.smallrye.config.SmallRyeConfigProviderResolver; class ConfigBuildSteps { - - // Added in the RunTimeConfigurationGenerator to the runtime Config - static final String PROVIDER_CLASS_NAME = "io.quarkus.runtime.generated.ConfigSourceProviderImpl"; - static final String SERVICES_PREFIX = "META-INF/services/"; - @BuildStep - void generateConfigSources(List runTimeSources, - final BuildProducer generatedClass, - LiveReloadBuildItem liveReloadBuildItem) { - if (liveReloadBuildItem.isLiveReload()) { - return; - } - ClassOutput classOutput = new GeneratedClassGizmoAdaptor(generatedClass, false); - - try (ClassCreator cc = ClassCreator.builder().interfaces(ConfigSourceProvider.class).setFinal(true) - .className(PROVIDER_CLASS_NAME) - .classOutput(classOutput).build()) { - try (MethodCreator mc = cc.getMethodCreator(MethodDescriptor.ofMethod(ConfigSourceProvider.class, - "getConfigSources", Iterable.class, ClassLoader.class))) { - - final ResultHandle array = mc.newArray(ConfigSource.class, mc.load(runTimeSources.size())); - for (int i = 0; i < runTimeSources.size(); i++) { - final RunTimeConfigurationSourceBuildItem runTimeSource = runTimeSources.get(i); - final String className = runTimeSource.getClassName(); - final OptionalInt priority = runTimeSource.getPriority(); - ResultHandle value; - if (priority.isPresent()) { - value = mc.newInstance(MethodDescriptor.ofConstructor(className, int.class), - mc.load(priority.getAsInt())); - } else { - value = mc.newInstance(MethodDescriptor.ofConstructor(className)); - } - mc.writeArrayValue(array, i, value); - } - final ResultHandle list = mc.invokeStaticMethod( - MethodDescriptor.ofMethod(Arrays.class, "asList", List.class, Object[].class), array); - mc.returnValue(list); - } - } - } - // XXX replace this with constant-folded service loader impl @BuildStep void nativeServiceProviders( diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigDescriptionBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigDescriptionBuildStep.java index b4e98f466b6bd..3e631cca49a24 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigDescriptionBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigDescriptionBuildStep.java @@ -1,6 +1,5 @@ package io.quarkus.deployment.steps; -import static io.quarkus.runtime.annotations.ConfigPhase.BOOTSTRAP; import static io.quarkus.runtime.annotations.ConfigPhase.BUILD_AND_RUN_TIME_FIXED; import static io.quarkus.runtime.annotations.ConfigPhase.BUILD_TIME; import static io.quarkus.runtime.annotations.ConfigPhase.RUN_TIME; @@ -54,7 +53,6 @@ List createConfigDescriptions( List ret = new ArrayList<>(); processConfig(config.getReadResult().getBuildTimePatternMap(), ret, javadoc, BUILD_TIME); processConfig(config.getReadResult().getBuildTimeRunTimePatternMap(), ret, javadoc, BUILD_AND_RUN_TIME_FIXED); - processConfig(config.getReadResult().getBootstrapPatternMap(), ret, javadoc, BOOTSTRAP); processConfig(config.getReadResult().getRunTimePatternMap(), ret, javadoc, RUN_TIME); processMappings(config.getReadResult().getBuildTimeMappings(), ret, javadoc, BUILD_TIME); processMappings(config.getReadResult().getBuildTimeRunTimeMappings(), ret, javadoc, BUILD_AND_RUN_TIME_FIXED); diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java index 48bd549b6edd6..5403b4d14442e 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java @@ -18,7 +18,6 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -26,7 +25,6 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; -import java.util.stream.Collectors; import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.ConfigProvider; @@ -41,7 +39,6 @@ import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.ExecutionTime; import io.quarkus.deployment.annotations.Record; -import io.quarkus.deployment.builditem.AdditionalBootstrapConfigSourceProviderBuildItem; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.ConfigClassBuildItem; import io.quarkus.deployment.builditem.ConfigMappingBuildItem; @@ -54,8 +51,6 @@ import io.quarkus.deployment.builditem.RunTimeConfigBuilderBuildItem; import io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem; import io.quarkus.deployment.builditem.StaticInitConfigBuilderBuildItem; -import io.quarkus.deployment.builditem.StaticInitConfigSourceFactoryBuildItem; -import io.quarkus.deployment.builditem.StaticInitConfigSourceProviderBuildItem; import io.quarkus.deployment.builditem.SuppressNonRuntimeConfigChangedWarningBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.configuration.BuildTimeConfigurationReader; @@ -80,7 +75,6 @@ import io.quarkus.runtime.configuration.RuntimeOverrideConfigSource; import io.smallrye.config.ConfigMappings.ConfigClassWithPrefix; import io.smallrye.config.ConfigSourceFactory; -import io.smallrye.config.PropertiesLocationConfigSourceFactory; import io.smallrye.config.SmallRyeConfig; import io.smallrye.config.SmallRyeConfigBuilder; @@ -92,15 +86,6 @@ public class ConfigGenerationBuildStep { SmallRyeConfigBuilder.class, "withSources", SmallRyeConfigBuilder.class, ConfigSource[].class); - @BuildStep - void staticInitSources( - BuildProducer staticInitConfigSourceProviderBuildItem, - BuildProducer staticInitConfigSourceFactoryBuildItem) { - - staticInitConfigSourceFactoryBuildItem.produce(new StaticInitConfigSourceFactoryBuildItem( - PropertiesLocationConfigSourceFactory.class.getName())); - } - @BuildStep void buildTimeRunTimeConfig( ConfigurationBuildItem configItem, @@ -271,9 +256,6 @@ void generateConfigClass( BuildProducer generatedClass, BuildProducer reflectiveClass, LiveReloadBuildItem liveReloadBuildItem, - List additionalBootstrapConfigSourceProviders, - List staticInitConfigSourceProviders, - List staticInitConfigSourceFactories, List configMappings, List staticInitConfigBuilders, List runTimeConfigBuilders) @@ -290,14 +272,8 @@ void generateConfigClass( Set discoveredConfigSourceProviders = discoverService(ConfigSourceProvider.class, reflectiveClass); Set discoveredConfigSourceFactories = discoverService(ConfigSourceFactory.class, reflectiveClass); - Set staticConfigSourceProviders = new HashSet<>(); - staticConfigSourceProviders.addAll(staticSafeServices(discoveredConfigSourceProviders)); - staticConfigSourceProviders.addAll(staticInitConfigSourceProviders.stream() - .map(StaticInitConfigSourceProviderBuildItem::getProviderClassName).collect(toSet())); - Set staticConfigSourceFactories = new HashSet<>(); - staticConfigSourceFactories.addAll(staticSafeServices(discoveredConfigSourceFactories)); - staticConfigSourceFactories.addAll(staticInitConfigSourceFactories.stream() - .map(StaticInitConfigSourceFactoryBuildItem::getFactoryClassName).collect(Collectors.toSet())); + Set staticConfigSourceProviders = staticSafeServices(discoveredConfigSourceProviders); + Set staticConfigSourceFactories = staticSafeServices(discoveredConfigSourceFactories); // TODO - duplicated now builderMappings. Still required to filter the unknown properties Set staticMappings = new HashSet<>(); @@ -323,8 +299,6 @@ void generateConfigClass( .setLiveReloadPossible(launchModeBuildItem.getLaunchMode() == LaunchMode.DEVELOPMENT || launchModeBuildItem.isAuxiliaryApplication()) .setAdditionalTypes(typeItems.stream().map(ConfigurationTypeBuildItem::getValueType).collect(toList())) - .setAdditionalBootstrapConfigSourceProviders( - getAdditionalBootstrapConfigSourceProviders(additionalBootstrapConfigSourceProviders)) .setStaticConfigSources(staticSafeServices(discoveredConfigSources)) .setStaticConfigSourceProviders(staticConfigSourceProviders) .setStaticConfigSourceFactories(staticConfigSourceFactories) @@ -348,18 +322,6 @@ private static void reportUnknownBuildProperties(LaunchMode launchMode, Set getAdditionalBootstrapConfigSourceProviders( - List additionalBootstrapConfigSourceProviders) { - if (additionalBootstrapConfigSourceProviders.isEmpty()) { - return Collections.emptyList(); - } - List result = new ArrayList<>(additionalBootstrapConfigSourceProviders.size()); - for (AdditionalBootstrapConfigSourceProviderBuildItem provider : additionalBootstrapConfigSourceProviders) { - result.add(provider.getProviderClassName()); - } - return result; - } - @BuildStep public void suppressNonRuntimeConfigChanged( BuildProducer suppressNonRuntimeConfigChanged) { diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/RuntimeConfigSetupBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/RuntimeConfigSetupBuildStep.java index 3f15d2c250217..ef5fcb0467473 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/RuntimeConfigSetupBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/RuntimeConfigSetupBuildStep.java @@ -1,41 +1,22 @@ package io.quarkus.deployment.steps; -import static io.quarkus.deployment.configuration.RunTimeConfigurationGenerator.C_INSTANCE; -import static io.quarkus.gizmo.MethodDescriptor.ofConstructor; +import static io.quarkus.deployment.configuration.RunTimeConfigurationGenerator.C_CREATE_RUN_TIME_CONFIG; import static io.quarkus.gizmo.MethodDescriptor.ofMethod; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.microprofile.config.spi.ConfigSourceProvider; -import org.jboss.logging.Logger; - import io.quarkus.deployment.GeneratedClassGizmoAdaptor; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.annotations.Consume; import io.quarkus.deployment.annotations.Produce; -import io.quarkus.deployment.builditem.BootstrapConfigSetupCompleteBuildItem; import io.quarkus.deployment.builditem.GeneratedClassBuildItem; import io.quarkus.deployment.builditem.MainBytecodeRecorderBuildItem; -import io.quarkus.deployment.builditem.RunTimeConfigurationSourceValueBuildItem; import io.quarkus.deployment.builditem.RuntimeConfigSetupCompleteBuildItem; -import io.quarkus.deployment.configuration.RunTimeConfigurationGenerator; -import io.quarkus.deployment.recording.BytecodeRecorderImpl; import io.quarkus.gizmo.ClassCreator; import io.quarkus.gizmo.ClassOutput; import io.quarkus.gizmo.MethodCreator; -import io.quarkus.gizmo.MethodDescriptor; -import io.quarkus.gizmo.ResultHandle; -import io.quarkus.runtime.RuntimeValue; import io.quarkus.runtime.StartupContext; import io.quarkus.runtime.StartupTask; public class RuntimeConfigSetupBuildStep { - - private static final Logger log = Logger.getLogger(ReflectiveHierarchyStep.class); - private static final String RUNTIME_CONFIG_STARTUP_TASK_CLASS_NAME = "io.quarkus.deployment.steps.RuntimeConfigSetup"; /** @@ -45,9 +26,8 @@ public class RuntimeConfigSetupBuildStep { * configuration */ @BuildStep - @Consume(BootstrapConfigSetupCompleteBuildItem.class) @Produce(RuntimeConfigSetupCompleteBuildItem.class) - void setupRuntimeConfig(List runTimeConfigurationSourceValues, + void setupRuntimeConfig( BuildProducer generatedClass, BuildProducer mainBytecodeRecorder) { ClassOutput classOutput = new GeneratedClassGizmoAdaptor(generatedClass, true); @@ -60,39 +40,7 @@ void setupRuntimeConfig(List runTimeCo method.invokeVirtualMethod(ofMethod(StartupContext.class, "setCurrentBuildStepName", void.class, String.class), method.getMethodParam(0), method.load("RuntimeConfigSetupBuildStep.setupRuntimeConfig")); - ResultHandle config = method.readStaticField(C_INSTANCE); - - if (runTimeConfigurationSourceValues.isEmpty()) { - method.invokeVirtualMethod(RunTimeConfigurationGenerator.C_READ_CONFIG, config, - method.invokeStaticMethod(ofMethod(Collections.class, "emptyList", List.class))); - } else { - ResultHandle startupContext = method.getMethodParam(0); - ResultHandle configSourcesProvidersList = method.newInstance(ofConstructor(ArrayList.class, int.class), - method.load(runTimeConfigurationSourceValues.size())); - for (RunTimeConfigurationSourceValueBuildItem runTimeConfigurationSourceValue : runTimeConfigurationSourceValues) { - RuntimeValue runtimeValue = runTimeConfigurationSourceValue - .getConfigSourcesValue(); - if (runtimeValue instanceof BytecodeRecorderImpl.ReturnedProxy) { - String proxyId = ((BytecodeRecorderImpl.ReturnedProxy) runtimeValue).__returned$proxy$key(); - ResultHandle value = method.invokeVirtualMethod( - ofMethod(StartupContext.class, "getValue", Object.class, String.class), - startupContext, method.load(proxyId)); - ResultHandle configSourceProvider = method - .invokeVirtualMethod(ofMethod(RuntimeValue.class, "getValue", Object.class), - method.checkCast(value, RuntimeValue.class)); - method.invokeVirtualMethod( - MethodDescriptor.ofMethod(ArrayList.class, "add", boolean.class, Object.class), - configSourcesProvidersList, - method.checkCast(configSourceProvider, ConfigSourceProvider.class)); - } else { - log.warn("RuntimeValue " + runtimeValue - + " was not produced by a recorder and it will thus be ignored"); - } - } - method.invokeVirtualMethod(RunTimeConfigurationGenerator.C_READ_CONFIG, config, - configSourcesProvidersList); - } - + method.invokeStaticMethod(C_CREATE_RUN_TIME_CONFIG); method.returnValue(null); } } diff --git a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java index 8a24f7ede0aa3..d1587be7752e3 100644 --- a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java +++ b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java @@ -148,7 +148,7 @@ public void run() { try { final Class configClass = Class.forName(RunTimeConfigurationGenerator.CONFIG_CLASS_NAME, true, runtimeClassLoader); - configClass.getDeclaredMethod(RunTimeConfigurationGenerator.C_CREATE_BOOTSTRAP_CONFIG.getName()) + configClass.getDeclaredMethod(RunTimeConfigurationGenerator.C_CREATE_RUN_TIME_CONFIG.getName()) .invoke(null); } catch (Throwable t2) { t.addSuppressed(t2); @@ -260,7 +260,7 @@ public RunningQuarkusApplication run(String... args) throws Exception { try { final Class configClass = Class.forName(RunTimeConfigurationGenerator.CONFIG_CLASS_NAME, true, runtimeClassLoader); - configClass.getDeclaredMethod(RunTimeConfigurationGenerator.C_CREATE_BOOTSTRAP_CONFIG.getName()) + configClass.getDeclaredMethod(RunTimeConfigurationGenerator.C_CREATE_RUN_TIME_CONFIG.getName()) .invoke(null); } catch (Throwable t2) { t.addSuppressed(t2); diff --git a/core/processor/src/main/java/io/quarkus/annotation/processor/generate_doc/ConfigPhase.java b/core/processor/src/main/java/io/quarkus/annotation/processor/generate_doc/ConfigPhase.java index b89a144d20b4e..5120966ee2280 100644 --- a/core/processor/src/main/java/io/quarkus/annotation/processor/generate_doc/ConfigPhase.java +++ b/core/processor/src/main/java/io/quarkus/annotation/processor/generate_doc/ConfigPhase.java @@ -6,8 +6,6 @@ public enum ConfigPhase implements Comparable { RUN_TIME("The configuration is overridable at runtime", "", "RunTime"), - BOOTSTRAP("The configuration is used to bootstrap runtime Config Sources and is overridable at runtime", - "", "Bootstrap"), BUILD_TIME("The configuration is not overridable at runtime", Constants.CONFIG_PHASE_BUILD_TIME_ILLUSTRATION, "BuildTime"), BUILD_AND_RUN_TIME_FIXED("The configuration is not overridable at runtime", Constants.CONFIG_PHASE_BUILD_TIME_ILLUSTRATION, "BuildTime"); @@ -39,14 +37,6 @@ public int compare(ConfigPhase firstPhase, ConfigPhase secondPhase) { return -1; } } - case BOOTSTRAP: { - switch (secondPhase) { - case BOOTSTRAP: - return 0; - default: - return 1; - } - } case RUN_TIME: { switch (secondPhase) { case RUN_TIME: diff --git a/core/runtime/src/main/java/io/quarkus/runtime/annotations/ConfigPhase.java b/core/runtime/src/main/java/io/quarkus/runtime/annotations/ConfigPhase.java index 318586535d96f..5e519622332e8 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/annotations/ConfigPhase.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/annotations/ConfigPhase.java @@ -10,16 +10,6 @@ public enum ConfigPhase { */ BUILD_AND_RUN_TIME_FIXED(true, true, false, "Build time and run time fixed"), - /** - * Values are read and available for usage at run time and are re-read on each program execution. These values - * are used to configure ConfigSourceProvider implementations - * - * @deprecated Please use {@link io.smallrye.config.ConfigSourceFactory.ConfigurableConfigSourceFactory} and - * register it in a {@link io.quarkus.runtime.configuration.ConfigBuilder}. - */ - @Deprecated - BOOTSTRAP(false, true, true, "Bootstrap"), - /** * Values are read and available for usage at run time and are re-read on each program execution. */ 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 649a612ed8433..adf9a55b15637 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 @@ -76,24 +76,12 @@ public static SmallRyeConfigBuilder configBuilder(final boolean runTime, final L */ public static SmallRyeConfigBuilder configBuilder(final boolean runTime, final boolean addDiscovered, final LaunchMode launchMode) { - return configBuilder(runTime, false, addDiscovered, launchMode); - } - - /** - * Get the basic configuration builder. - * - * @param runTime {@code true} if the configuration is run time, {@code false} if build time - * @param addDiscovered {@code true} if the ConfigSource and Converter objects should be auto-discovered - * @return the configuration builder - */ - public static SmallRyeConfigBuilder configBuilder(final boolean runTime, final boolean bootstrap, - final boolean addDiscovered, final LaunchMode launchMode) { SmallRyeConfigBuilder builder = emptyConfigBuilder(); - if (launchMode.isDevOrTest() && (runTime || bootstrap)) { + if (launchMode.isDevOrTest() && runTime) { builder.withSources(new RuntimeOverrideConfigSource(Thread.currentThread().getContextClassLoader())); } - if (runTime || bootstrap) { + if (runTime) { builder.withDefaultValue(UUID_KEY, UUID.randomUUID().toString()); } if (addDiscovered) { diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveProcessor.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveProcessor.java index 49689d0452ff9..667cfd0f69b31 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveProcessor.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveProcessor.java @@ -145,7 +145,6 @@ import io.quarkus.deployment.builditem.ShutdownContextBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveHierarchyBuildItem; -import io.quarkus.deployment.configuration.ConfigurationError; import io.quarkus.deployment.pkg.builditem.CompiledJavaVersionBuildItem; import io.quarkus.deployment.recording.RecorderContext; import io.quarkus.deployment.util.ServiceUtil; @@ -195,6 +194,7 @@ import io.quarkus.resteasy.reactive.spi.MessageBodyWriterOverrideBuildItem; import io.quarkus.runtime.LaunchMode; import io.quarkus.runtime.RuntimeValue; +import io.quarkus.runtime.configuration.ConfigurationException; import io.quarkus.security.AuthenticationCompletionException; import io.quarkus.security.AuthenticationFailedException; import io.quarkus.security.AuthenticationRedirectException; @@ -1356,7 +1356,7 @@ private void checkForDuplicateEndpoint(ResteasyReactiveConfig config, Map 0) { if (config.failOnDuplicate()) { - throw new ConfigurationError(message); + throw new ConfigurationException(message); } log.warn(message); } diff --git a/integration-tests/bootstrap-config/application/pom.xml b/integration-tests/bootstrap-config/application/pom.xml deleted file mode 100644 index 68f03cc2defbc..0000000000000 --- a/integration-tests/bootstrap-config/application/pom.xml +++ /dev/null @@ -1,157 +0,0 @@ - - - 4.0.0 - - - io.quarkus - quarkus-integration-test-bootstrap-config - 999-SNAPSHOT - - - quarkus-integration-test-bootstrap-config-application - Quarkus - Integration Tests - Bootstrap Config - Application - - - - io.quarkus - quarkus-resteasy - - - io.quarkus - quarkus-resteasy-jackson - - - io.quarkus - quarkus-integration-test-bootstrap-config-extension - ${project.version} - - - - io.quarkus - quarkus-junit5 - test - - - io.rest-assured - rest-assured - test - - - - - io.quarkus - quarkus-integration-test-bootstrap-config-extension-deployment - ${project.version} - pom - test - - - * - * - - - - - io.quarkus - quarkus-resteasy-deployment - ${project.version} - pom - test - - - * - * - - - - - io.quarkus - quarkus-resteasy-jackson-deployment - ${project.version} - pom - test - - - * - * - - - - - - - - - io.quarkus - quarkus-maven-plugin - - - - build - - - - - - maven-compiler-plugin - ${compiler-plugin.version} - - - org.apache.maven.plugins - maven-surefire-plugin - - - system - - - - - - - - - native - - - native - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - ${native.surefire.skip} - - - - maven-failsafe-plugin - - - - integration-test - verify - - - - system - locations - - - ${project.build.directory}/${project.build.finalName}-runner - - - - - - - - - native - - - - diff --git a/integration-tests/bootstrap-config/application/src/main/java/io/quarkus/it/bootstrap/config/ConfigResource.java b/integration-tests/bootstrap-config/application/src/main/java/io/quarkus/it/bootstrap/config/ConfigResource.java deleted file mode 100644 index 255f008a1f7eb..0000000000000 --- a/integration-tests/bootstrap-config/application/src/main/java/io/quarkus/it/bootstrap/config/ConfigResource.java +++ /dev/null @@ -1,33 +0,0 @@ -package io.quarkus.it.bootstrap.config; - -import jakarta.inject.Inject; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import io.quarkus.runtime.annotations.RegisterForReflection; -import io.smallrye.config.SmallRyeConfig; - -@Path("/config") -@Produces(MediaType.APPLICATION_JSON) -public class ConfigResource { - @Inject - SmallRyeConfig config; - - @GET - @Path("/{name}") - public Response configValue(@PathParam("name") final String name) { - return Response.ok(config.getConfigValue(name)).build(); - } - - @RegisterForReflection(targets = { - org.eclipse.microprofile.config.ConfigValue.class, - io.smallrye.config.ConfigValue.class - }) - public static class ConfigValueReflection { - - } -} diff --git a/integration-tests/bootstrap-config/application/src/main/resources/application.properties b/integration-tests/bootstrap-config/application/src/main/resources/application.properties deleted file mode 100644 index 9e21d17d2e9be..0000000000000 --- a/integration-tests/bootstrap-config/application/src/main/resources/application.properties +++ /dev/null @@ -1,3 +0,0 @@ -quarkus.dummy.name=foo -quarkus.dummy.times=9 -quarkus.dummy.map.key=value diff --git a/integration-tests/bootstrap-config/application/src/main/resources/config.properties b/integration-tests/bootstrap-config/application/src/main/resources/config.properties deleted file mode 100644 index fdc70f4d5dc08..0000000000000 --- a/integration-tests/bootstrap-config/application/src/main/resources/config.properties +++ /dev/null @@ -1 +0,0 @@ -quarkus.dummy.map.locations=locations diff --git a/integration-tests/bootstrap-config/application/src/test/java/io/quarkus/it/bootstrap/config/ConfigResourceTest.java b/integration-tests/bootstrap-config/application/src/test/java/io/quarkus/it/bootstrap/config/ConfigResourceTest.java deleted file mode 100644 index b78cdb8fe9113..0000000000000 --- a/integration-tests/bootstrap-config/application/src/test/java/io/quarkus/it/bootstrap/config/ConfigResourceTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package io.quarkus.it.bootstrap.config; - -import static io.restassured.RestAssured.given; -import static jakarta.ws.rs.core.Response.Status.OK; -import static org.hamcrest.Matchers.equalTo; - -import org.junit.jupiter.api.Test; - -import io.quarkus.test.junit.QuarkusTest; - -@QuarkusTest -class ConfigResourceTest { - @Test - void bootstrap() { - given() - .get("/config/{name}", "quarkus.dummy.name") - .then() - .statusCode(OK.getStatusCode()) - .body("value", equalTo("foo")) - .body("configSourceName", equalTo("bootstrap")); - - given() - .get("/config/{name}", "quarkus.dummy.times") - .then() - .statusCode(OK.getStatusCode()) - .body("value", equalTo("9")) - .body("configSourceName", equalTo("bootstrap")); - - given() - .get("/config/{name}", "quarkus.dummy.map.key") - .then() - .statusCode(OK.getStatusCode()) - .body("value", equalTo("value")) - .body("configSourceName", equalTo("bootstrap")); - - given() - .get("/config/{name}", "quarkus.dummy.map.system") - .then() - .statusCode(OK.getStatusCode()) - .body("value", equalTo("system")) - .body("configSourceName", equalTo("bootstrap")); - } - - @Test - void locations() { - given() - .get("/config/{name}", "quarkus.dummy.map.locations") - .then() - .statusCode(OK.getStatusCode()) - .body("value", equalTo("locations")) - .body("configSourceName", equalTo("bootstrap")); - } -} diff --git a/integration-tests/bootstrap-config/application/src/test/java/io/quarkus/it/bootstrap/config/ConfigResourceTestIT.java b/integration-tests/bootstrap-config/application/src/test/java/io/quarkus/it/bootstrap/config/ConfigResourceTestIT.java deleted file mode 100644 index 582a011248d8c..0000000000000 --- a/integration-tests/bootstrap-config/application/src/test/java/io/quarkus/it/bootstrap/config/ConfigResourceTestIT.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.quarkus.it.bootstrap.config; - -import io.quarkus.test.junit.QuarkusIntegrationTest; - -@QuarkusIntegrationTest -class ConfigResourceTestIT extends ConfigResourceTest { -} diff --git a/integration-tests/bootstrap-config/extension/deployment/pom.xml b/integration-tests/bootstrap-config/extension/deployment/pom.xml deleted file mode 100644 index 53a6eb9d6cadc..0000000000000 --- a/integration-tests/bootstrap-config/extension/deployment/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - 4.0.0 - - - io.quarkus - quarkus-integration-test-bootstrap-config-extension-parent - 999-SNAPSHOT - - - quarkus-integration-test-bootstrap-config-extension-deployment - Quarkus - Integration Tests - Bootstrap Config - Extension - Deployment - - - - io.quarkus - quarkus-core-deployment - - - io.quarkus - quarkus-integration-test-bootstrap-config-extension - 999-SNAPSHOT - - - - - - - maven-compiler-plugin - - - - io.quarkus - quarkus-extension-processor - ${project.version} - - - - - - - - \ No newline at end of file diff --git a/integration-tests/bootstrap-config/extension/deployment/src/main/java/io/quarkus/it/bootstrap/config/extension/deployment/DummyBootstrapConfigBuildStep.java b/integration-tests/bootstrap-config/extension/deployment/src/main/java/io/quarkus/it/bootstrap/config/extension/deployment/DummyBootstrapConfigBuildStep.java deleted file mode 100644 index 917d5b48e1b22..0000000000000 --- a/integration-tests/bootstrap-config/extension/deployment/src/main/java/io/quarkus/it/bootstrap/config/extension/deployment/DummyBootstrapConfigBuildStep.java +++ /dev/null @@ -1,35 +0,0 @@ -package io.quarkus.it.bootstrap.config.extension.deployment; - -import io.quarkus.deployment.annotations.BuildProducer; -import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.annotations.ExecutionTime; -import io.quarkus.deployment.annotations.Record; -import io.quarkus.deployment.builditem.RunTimeConfigBuilderBuildItem; -import io.quarkus.deployment.builditem.RunTimeConfigurationSourceValueBuildItem; -import io.quarkus.deployment.builditem.StaticInitConfigBuilderBuildItem; -import io.quarkus.it.bootstrap.config.extension.DummyBootstrapRecorder; -import io.quarkus.it.bootstrap.config.extension.DummyBootstrapRecorder2; -import io.quarkus.it.bootstrap.config.extension.DummyConfig; -import io.quarkus.it.bootstrap.config.extension.DummyConfigBuilder; - -public class DummyBootstrapConfigBuildStep { - @BuildStep - public void configBuilders(BuildProducer staticConfigBuilders, - BuildProducer runtimeConfigBuilders) { - staticConfigBuilders.produce(new StaticInitConfigBuilderBuildItem(DummyConfigBuilder.class.getName())); - runtimeConfigBuilders.produce(new RunTimeConfigBuilderBuildItem(DummyConfigBuilder.class.getName())); - } - - @BuildStep - @Record(ExecutionTime.RUNTIME_INIT) - public RunTimeConfigurationSourceValueBuildItem dummyRecorder(DummyBootstrapRecorder recorder, DummyConfig dummyConfig) { - return new RunTimeConfigurationSourceValueBuildItem(recorder.create(dummyConfig)); - } - - @BuildStep - @Record(ExecutionTime.RUNTIME_INIT) - public void dummyRecorder2(DummyBootstrapRecorder2 recorder, - BuildProducer producer) { - producer.produce(new RunTimeConfigurationSourceValueBuildItem(recorder.create())); - } -} diff --git a/integration-tests/bootstrap-config/extension/pom.xml b/integration-tests/bootstrap-config/extension/pom.xml deleted file mode 100644 index 4b8e33fabd2b1..0000000000000 --- a/integration-tests/bootstrap-config/extension/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 4.0.0 - - - io.quarkus - quarkus-build-parent - 999-SNAPSHOT - ../../../build-parent/pom.xml - - - quarkus-integration-test-bootstrap-config-extension-parent - Quarkus - Integration Tests - Bootstrap Config - Extension - pom - - - deployment - runtime - - - - \ No newline at end of file diff --git a/integration-tests/bootstrap-config/extension/runtime/pom.xml b/integration-tests/bootstrap-config/extension/runtime/pom.xml deleted file mode 100644 index 752839d96bbb7..0000000000000 --- a/integration-tests/bootstrap-config/extension/runtime/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - 4.0.0 - - - io.quarkus - quarkus-integration-test-bootstrap-config-extension-parent - 999-SNAPSHOT - - - quarkus-integration-test-bootstrap-config-extension - Quarkus - Integration Tests - Bootstrap Config - Extension - Runtime - - - - io.quarkus - quarkus-core - - - - - - - io.quarkus - quarkus-extension-maven-plugin - - - maven-compiler-plugin - - - - io.quarkus - quarkus-extension-processor - ${project.version} - - - - - - - \ No newline at end of file diff --git a/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyBootstrapRecorder.java b/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyBootstrapRecorder.java deleted file mode 100644 index a4eb598c09c29..0000000000000 --- a/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyBootstrapRecorder.java +++ /dev/null @@ -1,13 +0,0 @@ -package io.quarkus.it.bootstrap.config.extension; - -import org.eclipse.microprofile.config.spi.ConfigSourceProvider; - -import io.quarkus.runtime.RuntimeValue; -import io.quarkus.runtime.annotations.Recorder; - -@Recorder -public class DummyBootstrapRecorder { - public RuntimeValue create(DummyConfig dummyConfig) { - return new RuntimeValue<>(new DummyConfigSourceProvider(dummyConfig)); - } -} diff --git a/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyBootstrapRecorder2.java b/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyBootstrapRecorder2.java deleted file mode 100644 index 80424f00bc93f..0000000000000 --- a/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyBootstrapRecorder2.java +++ /dev/null @@ -1,22 +0,0 @@ -package io.quarkus.it.bootstrap.config.extension; - -import java.util.Collections; - -import org.eclipse.microprofile.config.spi.ConfigSource; -import org.eclipse.microprofile.config.spi.ConfigSourceProvider; - -import io.quarkus.runtime.RuntimeValue; -import io.quarkus.runtime.annotations.Recorder; - -@Recorder -public class DummyBootstrapRecorder2 { - - public RuntimeValue create() { - return new RuntimeValue<>(new ConfigSourceProvider() { - @Override - public Iterable getConfigSources(ClassLoader forClassLoader) { - return Collections.emptyList(); - } - }); - } -} diff --git a/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyConfig.java b/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyConfig.java deleted file mode 100644 index 94ddc9f6a7d80..0000000000000 --- a/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyConfig.java +++ /dev/null @@ -1,38 +0,0 @@ -package io.quarkus.it.bootstrap.config.extension; - -import java.util.Map; - -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; -import io.quarkus.runtime.annotations.ConfigPhase; -import io.quarkus.runtime.annotations.ConfigRoot; - -@ConfigRoot(phase = ConfigPhase.BOOTSTRAP) -public class DummyConfig { - - /** - * dummy name - */ - public String name; - - /** - * dummy times - */ - @ConfigItem(defaultValue = "2") - public Integer times; - - /** - * dummy map - */ - @ConfigItem(name = "map") - public Map map; - - @ConfigGroup - public static class MapConfig { - /** - * dummy value - */ - @ConfigItem(name = ConfigItem.PARENT) - public String value; - } -} diff --git a/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyConfigBuilder.java b/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyConfigBuilder.java deleted file mode 100644 index 635e171fedb65..0000000000000 --- a/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyConfigBuilder.java +++ /dev/null @@ -1,16 +0,0 @@ -package io.quarkus.it.bootstrap.config.extension; - -import io.quarkus.runtime.configuration.ConfigBuilder; -import io.smallrye.config.SmallRyeConfigBuilder; - -/** - * This would make sure that quarkus.config.locations is only set during runtime (and not used and recorded during - * build time). - */ -public class DummyConfigBuilder implements ConfigBuilder { - @Override - public SmallRyeConfigBuilder configBuilder(final SmallRyeConfigBuilder builder) { - builder.withDefaultValue("quarkus.config.locations", "config.properties"); - return builder; - } -} diff --git a/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyConfigSourceProvider.java b/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyConfigSourceProvider.java deleted file mode 100644 index e1f133fd2dbff..0000000000000 --- a/integration-tests/bootstrap-config/extension/runtime/src/main/java/io/quarkus/it/bootstrap/config/extension/DummyConfigSourceProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -package io.quarkus.it.bootstrap.config.extension; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.microprofile.config.spi.ConfigSource; -import org.eclipse.microprofile.config.spi.ConfigSourceProvider; - -import io.smallrye.config.common.MapBackedConfigSource; - -public class DummyConfigSourceProvider implements ConfigSourceProvider { - private final DummyConfig dummyConfig; - - public DummyConfigSourceProvider(DummyConfig dummyConfig) { - this.dummyConfig = dummyConfig; - } - - @Override - public Iterable getConfigSources(ClassLoader forClassLoader) { - // Just copy the bootstrap config values to a new source - Map properties = new HashMap<>(); - properties.put("quarkus.dummy.name", dummyConfig.name); - properties.put("quarkus.dummy.times", dummyConfig.times.toString()); - dummyConfig.map.forEach((key, mapConfig) -> properties.put("quarkus.dummy.map." + key, mapConfig.value)); - return List.of(new MapBackedConfigSource("bootstrap", properties, Integer.MAX_VALUE) { - }); - } -} diff --git a/integration-tests/bootstrap-config/pom.xml b/integration-tests/bootstrap-config/pom.xml deleted file mode 100644 index 661b61cfee01b..0000000000000 --- a/integration-tests/bootstrap-config/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - 4.0.0 - - - io.quarkus - quarkus-integration-tests-parent - 999-SNAPSHOT - - - quarkus-integration-test-bootstrap-config - Quarkus - Integration Tests - Bootstrap Config - pom - - - extension - application - - - \ No newline at end of file diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index edbce987659e5..f8ade27d11648 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -323,7 +323,6 @@ logging-gelf cache qute - bootstrap-config injectmock reactive-messaging-amqp reactive-messaging-kafka @@ -512,4 +511,4 @@ - \ No newline at end of file +