diff --git a/extensions/funqy/funqy-amazon-lambda/runtime/src/main/java/io/quarkus/funqy/lambda/FunqyLambdaBindingRecorder.java b/extensions/funqy/funqy-amazon-lambda/runtime/src/main/java/io/quarkus/funqy/lambda/FunqyLambdaBindingRecorder.java index 29ae0fd378bb6..7fa241b8c1368 100644 --- a/extensions/funqy/funqy-amazon-lambda/runtime/src/main/java/io/quarkus/funqy/lambda/FunqyLambdaBindingRecorder.java +++ b/extensions/funqy/funqy-amazon-lambda/runtime/src/main/java/io/quarkus/funqy/lambda/FunqyLambdaBindingRecorder.java @@ -72,10 +72,10 @@ public void init(BeanContainer bc, FunqyAmazonBuildTimeConfig buildTimeConfig) { public void chooseInvoker(FunqyConfig config, FunqyAmazonConfig amazonConfig) { // this is done at Runtime so that we can change it with an environment variable. - if (config.export.isPresent()) { - invoker = FunctionRecorder.registry.matchInvoker(config.export.get()); + if (config.export().isPresent()) { + invoker = FunctionRecorder.registry.matchInvoker(config.export().get()); if (invoker == null) { - throw new RuntimeException("quarkus.funqy.export does not match a function: " + config.export.get()); + throw new RuntimeException("quarkus.funqy.export does not match a function: " + config.export().get()); } } else if (FunctionRecorder.registry.invokers().size() == 0) { throw new RuntimeException("There are no functions to process lambda"); diff --git a/extensions/funqy/funqy-google-cloud-functions/runtime/src/main/java/io/quarkus/funqy/gcp/functions/FunqyCloudFunctionsBindingRecorder.java b/extensions/funqy/funqy-google-cloud-functions/runtime/src/main/java/io/quarkus/funqy/gcp/functions/FunqyCloudFunctionsBindingRecorder.java index 4ae45066d22e2..2a4ad2ad7d26a 100644 --- a/extensions/funqy/funqy-google-cloud-functions/runtime/src/main/java/io/quarkus/funqy/gcp/functions/FunqyCloudFunctionsBindingRecorder.java +++ b/extensions/funqy/funqy-google-cloud-functions/runtime/src/main/java/io/quarkus/funqy/gcp/functions/FunqyCloudFunctionsBindingRecorder.java @@ -52,10 +52,10 @@ public void init(BeanContainer bc) { public void chooseInvoker(FunqyConfig config) { // this is done at Runtime so that we can change it with an environment variable. - if (config.export.isPresent()) { - invoker = FunctionRecorder.registry.matchInvoker(config.export.get()); + if (config.export().isPresent()) { + invoker = FunctionRecorder.registry.matchInvoker(config.export().get()); if (invoker == null) { - throw new RuntimeException("quarkus.funqy.export does not match a function: " + config.export.get()); + throw new RuntimeException("quarkus.funqy.export does not match a function: " + config.export().get()); } } else if (FunctionRecorder.registry.invokers().size() == 0) { throw new RuntimeException("There are no functions to process lambda"); diff --git a/extensions/funqy/funqy-knative-events/deployment/pom.xml b/extensions/funqy/funqy-knative-events/deployment/pom.xml index e5d33f9511422..b28d16b578f00 100644 --- a/extensions/funqy/funqy-knative-events/deployment/pom.xml +++ b/extensions/funqy/funqy-knative-events/deployment/pom.xml @@ -60,9 +60,6 @@ ${project.version} - - -AlegacyConfigRoot=true - diff --git a/extensions/funqy/funqy-knative-events/runtime/pom.xml b/extensions/funqy/funqy-knative-events/runtime/pom.xml index 242cd82ecac69..ad0bcd3420b33 100644 --- a/extensions/funqy/funqy-knative-events/runtime/pom.xml +++ b/extensions/funqy/funqy-knative-events/runtime/pom.xml @@ -47,9 +47,6 @@ ${project.version} - - -AlegacyConfigRoot=true - diff --git a/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/FunqyKnativeEventsConfig.java b/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/FunqyKnativeEventsConfig.java index ad04a3986ed67..d9016e3f6279f 100644 --- a/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/FunqyKnativeEventsConfig.java +++ b/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/FunqyKnativeEventsConfig.java @@ -4,15 +4,16 @@ import java.util.Optional; import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; +import io.smallrye.config.ConfigMapping; -@ConfigRoot(name = "funqy.knative-events", phase = ConfigPhase.RUN_TIME) -public class FunqyKnativeEventsConfig { +@ConfigRoot(phase = ConfigPhase.RUN_TIME) +@ConfigMapping(prefix = "quarkus.funqy.knative-events") +public interface FunqyKnativeEventsConfig { @ConfigGroup - public static class FunctionMapping { + interface FunctionMapping { /** * Cloud Event type (ce-type) that triggers this function. * Default value is function name. @@ -23,28 +24,24 @@ public static class FunctionMapping { * you to change the knative trigger binding without having to change the configuration * of the quarkus deployment. */ - @ConfigItem - public Optional trigger; + Optional trigger(); /** * If function has response output, then what is the Cloud Event type (ce-type)? * This will default to {function}.output */ - @ConfigItem - public Optional responseType; + Optional responseType(); /** * If function has response output, then what is the Cloud Event source (ce-source)? * This will default to the function name */ - @ConfigItem - public Optional responseSource; + Optional responseSource(); } /** * Cloud event to function mapping. Key to this map is a function name. */ - @ConfigItem - public Map mapping; + Map mapping(); } diff --git a/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/KnativeEventsBindingRecorder.java b/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/KnativeEventsBindingRecorder.java index 2872d9484227c..29263d6565a58 100644 --- a/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/KnativeEventsBindingRecorder.java +++ b/extensions/funqy/funqy-knative-events/runtime/src/main/java/io/quarkus/funqy/runtime/bindings/knative/events/KnativeEventsBindingRecorder.java @@ -187,24 +187,24 @@ public void run() { // This needs to happen in start at RUNTIME so that // mappings can be overridden by environment variables FunctionInvoker defaultInvoker = null; - if (funqyConfig.export.isPresent()) { - defaultInvoker = FunctionRecorder.registry.matchInvoker(funqyConfig.export.get()); + if (funqyConfig.export().isPresent()) { + defaultInvoker = FunctionRecorder.registry.matchInvoker(funqyConfig.export().get()); if (defaultInvoker == null) { - throw new RuntimeException("quarkus.funqy.export value does not map a function: " + funqyConfig.export.get()); + throw new RuntimeException("quarkus.funqy.export value does not map a function: " + funqyConfig.export().get()); } } - if (eventsConfig.mapping != null) { - for (Map.Entry entry : eventsConfig.mapping.entrySet()) { + if (eventsConfig.mapping() != null) { + for (Map.Entry entry : eventsConfig.mapping().entrySet()) { String functionName = entry.getKey(); FunctionInvoker invoker = FunctionRecorder.registry.matchInvoker(functionName); if (invoker == null) { throw new RuntimeException("knative-events.function-mapping does not map to a function: " + functionName); } FunqyKnativeEventsConfig.FunctionMapping mapping = entry.getValue(); - if (mapping.trigger.isPresent()) { - typeTriggers.compute(mapping.trigger.get(), (k, v) -> { + if (mapping.trigger().isPresent()) { + typeTriggers.compute(mapping.trigger().get(), (k, v) -> { if (v == null) { v = new ArrayList<>(); } @@ -213,11 +213,11 @@ public void run() { }); } if (invoker.hasOutput()) { - if (mapping.responseSource.isPresent()) { - invoker.getBindingContext().put(RESPONSE_SOURCE, mapping.responseSource.get()); + if (mapping.responseSource().isPresent()) { + invoker.getBindingContext().put(RESPONSE_SOURCE, mapping.responseSource().get()); } - if (mapping.responseType.isPresent()) { - invoker.getBindingContext().put(RESPONSE_TYPE, mapping.responseType.get()); + if (mapping.responseType().isPresent()) { + invoker.getBindingContext().put(RESPONSE_TYPE, mapping.responseType().get()); } } } diff --git a/extensions/funqy/funqy-server-common/deployment/pom.xml b/extensions/funqy/funqy-server-common/deployment/pom.xml index e3bc1f8f1c790..3e51278b52a7f 100644 --- a/extensions/funqy/funqy-server-common/deployment/pom.xml +++ b/extensions/funqy/funqy-server-common/deployment/pom.xml @@ -47,9 +47,6 @@ ${project.version} - - -AlegacyConfigRoot=true - diff --git a/extensions/funqy/funqy-server-common/runtime/pom.xml b/extensions/funqy/funqy-server-common/runtime/pom.xml index fd679939c8faf..edae768348ab0 100644 --- a/extensions/funqy/funqy-server-common/runtime/pom.xml +++ b/extensions/funqy/funqy-server-common/runtime/pom.xml @@ -52,9 +52,6 @@ ${project.version} - - -AlegacyConfigRoot=true - diff --git a/extensions/funqy/funqy-server-common/runtime/src/main/java/io/quarkus/funqy/runtime/FunqyConfig.java b/extensions/funqy/funqy-server-common/runtime/src/main/java/io/quarkus/funqy/runtime/FunqyConfig.java index 31f5b628355cb..59a64d121d927 100644 --- a/extensions/funqy/funqy-server-common/runtime/src/main/java/io/quarkus/funqy/runtime/FunqyConfig.java +++ b/extensions/funqy/funqy-server-common/runtime/src/main/java/io/quarkus/funqy/runtime/FunqyConfig.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 FunqyConfig { +@ConfigMapping(prefix = "quarkus.funqy") +public interface FunqyConfig { /** * The function to export. If there is more than one function @@ -15,6 +16,5 @@ public class FunqyConfig { * If there is only a single function, you do not have to set this config item. * */ - @ConfigItem - public Optional export; + Optional export(); }