From cb356f71bb64662ea82729bbb4c2fca58eaf16f5 Mon Sep 17 00:00:00 2001 From: Matheus Cruz Date: Mon, 13 Jan 2025 15:42:25 -0300 Subject: [PATCH] Convert google-cloud-functions to use @ConfigMapping --- extensions/google-cloud-functions/deployment/pom.xml | 3 --- extensions/google-cloud-functions/runtime/pom.xml | 3 --- .../gcp/functions/GoogleCloudFunctionRecorder.java | 4 ++-- .../quarkus/gcp/functions/GoogleCloudFunctionsConfig.java | 8 ++++---- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/extensions/google-cloud-functions/deployment/pom.xml b/extensions/google-cloud-functions/deployment/pom.xml index 83abc5b968a54..2d2ed97357080 100644 --- a/extensions/google-cloud-functions/deployment/pom.xml +++ b/extensions/google-cloud-functions/deployment/pom.xml @@ -43,9 +43,6 @@ ${project.version} - - -AlegacyConfigRoot=true - diff --git a/extensions/google-cloud-functions/runtime/pom.xml b/extensions/google-cloud-functions/runtime/pom.xml index df657c49d4b12..bda40750ee046 100644 --- a/extensions/google-cloud-functions/runtime/pom.xml +++ b/extensions/google-cloud-functions/runtime/pom.xml @@ -55,9 +55,6 @@ ${project.version} - - -AlegacyConfigRoot=true - diff --git a/extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/GoogleCloudFunctionRecorder.java b/extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/GoogleCloudFunctionRecorder.java index 8f4cb73a0d246..b832003567215 100644 --- a/extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/GoogleCloudFunctionRecorder.java +++ b/extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/GoogleCloudFunctionRecorder.java @@ -12,8 +12,8 @@ public class GoogleCloudFunctionRecorder { public void selectDelegate(GoogleCloudFunctionsConfig config, List cloudFunctions) { Map delegates = new HashMap<>(); // if a function name is defined, check that it exists - if (config.function.isPresent()) { - String functionName = config.function.get(); + if (config.function().isPresent()) { + String functionName = config.function().get(); boolean found = false; for (GoogleCloudFunctionInfo info : cloudFunctions) { if (functionName.equals(info.getBeanName())) { diff --git a/extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/GoogleCloudFunctionsConfig.java b/extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/GoogleCloudFunctionsConfig.java index 7e9d4229e3a7c..2bfdb8578a2ed 100644 --- a/extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/GoogleCloudFunctionsConfig.java +++ b/extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/GoogleCloudFunctionsConfig.java @@ -2,12 +2,13 @@ import java.util.Optional; -import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; +import io.smallrye.config.ConfigMapping; @ConfigRoot(phase = ConfigPhase.RUN_TIME) -public class GoogleCloudFunctionsConfig { +@ConfigMapping(prefix = "quarkus.google-cloud-functions") +public interface GoogleCloudFunctionsConfig { /** * The function name. Function names are specified on function classes using the {@link @jakarta.inject.Named} annotation. * @@ -15,6 +16,5 @@ public class GoogleCloudFunctionsConfig { * If there is only a single named function and the name is unspecified then the named function will be used. * These rules apply for each function implementation (HttpFunction, BackgroundFunction, RawBackgroundFunction). */ - @ConfigItem - public Optional function; + Optional function(); }