diff --git a/extensions/amazon-lambda/common-deployment/pom.xml b/extensions/amazon-lambda/common-deployment/pom.xml index 6fa00eea9b452..0fd84942a5f72 100644 --- a/extensions/amazon-lambda/common-deployment/pom.xml +++ b/extensions/amazon-lambda/common-deployment/pom.xml @@ -61,9 +61,6 @@ ${project.version} - - -AlegacyConfigRoot=true - diff --git a/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/DevServicesLambdaProcessor.java b/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/DevServicesLambdaProcessor.java index c30f5e707a21a..84c3f128445fb 100644 --- a/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/DevServicesLambdaProcessor.java +++ b/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/DevServicesLambdaProcessor.java @@ -63,7 +63,7 @@ public void startEventServer(LaunchModeBuildItem launchMode, return; if (legacyTestingEnabled()) return; - if (!config.mockEventServer.enabled) { + if (!config.mockEventServer().enabled()) { return; } if (server != null) { @@ -77,8 +77,8 @@ public void startEventServer(LaunchModeBuildItem launchMode, } server = supplier.get(); - int port = launchMode.getLaunchMode() == LaunchMode.TEST ? config.mockEventServer.testPort - : config.mockEventServer.devPort; + int port = launchMode.getLaunchMode() == LaunchMode.TEST ? config.mockEventServer().testPort() + : config.mockEventServer().devPort(); startMode = launchMode.getLaunchMode(); server.start(port); int actualPort = server.getPort(); diff --git a/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/LambdaConfig.java b/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/LambdaConfig.java index e9dcc8e4c3e61..36c15e3e3a77e 100644 --- a/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/LambdaConfig.java +++ b/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/LambdaConfig.java @@ -2,13 +2,15 @@ import io.quarkus.runtime.annotations.ConfigPhase; import io.quarkus.runtime.annotations.ConfigRoot; +import io.smallrye.config.ConfigMapping; @ConfigRoot(phase = ConfigPhase.BUILD_TIME) -public class LambdaConfig { +@ConfigMapping(prefix = "quarkus.lambda") +public interface LambdaConfig { /** * Configuration for the mock event server that is run * in dev mode and test mode */ - MockEventServerConfig mockEventServer; + MockEventServerConfig mockEventServer(); } diff --git a/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/MockEventServerConfig.java b/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/MockEventServerConfig.java index 85cde4c70a1fb..c2aa666e9810f 100644 --- a/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/MockEventServerConfig.java +++ b/extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/MockEventServerConfig.java @@ -1,29 +1,27 @@ package io.quarkus.amazon.lambda.deployment; -import io.quarkus.runtime.annotations.ConfigGroup; -import io.quarkus.runtime.annotations.ConfigItem; +import io.smallrye.config.WithDefault; /** * Configuration for the mock event server that is run * in dev mode and test mode */ -@ConfigGroup -public class MockEventServerConfig { +public interface MockEventServerConfig { /** * Setting to true will start event server even if quarkus.devservices.enabled=false */ - @ConfigItem(defaultValue = "true") - public boolean enabled; + @WithDefault("true") + boolean enabled(); /** * Port to access mock event server in dev mode */ - @ConfigItem(defaultValue = "8080") - public int devPort; + @WithDefault("8080") + int devPort(); /** * Port to access mock event server in dev mode */ - @ConfigItem(defaultValue = "8081") - public int testPort; + @WithDefault("8081") + int testPort(); } diff --git a/extensions/amazon-lambda/common-runtime/pom.xml b/extensions/amazon-lambda/common-runtime/pom.xml index eb8a8bab3501b..36b98ed34d715 100644 --- a/extensions/amazon-lambda/common-runtime/pom.xml +++ b/extensions/amazon-lambda/common-runtime/pom.xml @@ -72,9 +72,6 @@ ${project.version} - - -AlegacyConfigRoot=true - diff --git a/extensions/amazon-lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/AmazonLambdaProcessor.java b/extensions/amazon-lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/AmazonLambdaProcessor.java index d7b631b826e24..6ce046aa7da98 100644 --- a/extensions/amazon-lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/AmazonLambdaProcessor.java +++ b/extensions/amazon-lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/AmazonLambdaProcessor.java @@ -333,7 +333,7 @@ void startPoolLoopDevOrTest(AmazonLambdaRecorder recorder, void recordExpectedExceptions(LambdaBuildTimeConfig config, BuildProducer registerForReflection, AmazonLambdaStaticRecorder recorder) { - Set> classes = config.expectedExceptions.map(Set::copyOf).orElseGet(Set::of); + Set> classes = config.expectedExceptions().map(Set::copyOf).orElseGet(Set::of); classes.stream() .map(clazz -> ReflectiveClassBuildItem.builder(clazz).constructors(false) .reason(getClass().getName() + " expectedExceptions") diff --git a/extensions/amazon-lambda/runtime/pom.xml b/extensions/amazon-lambda/runtime/pom.xml index 0a565e1dbe5e1..e12340e996247 100644 --- a/extensions/amazon-lambda/runtime/pom.xml +++ b/extensions/amazon-lambda/runtime/pom.xml @@ -51,9 +51,6 @@ ${project.version} - - -AlegacyConfigRoot=true - diff --git a/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AmazonLambdaRecorder.java b/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AmazonLambdaRecorder.java index 49dc6d9d92a2b..6ff6371ae775b 100644 --- a/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AmazonLambdaRecorder.java +++ b/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AmazonLambdaRecorder.java @@ -120,12 +120,12 @@ public void chooseHandlerClass(List>> unnam Class> handlerClass = null; Class handlerStreamClass = null; - if (config.handler.isPresent()) { - handlerClass = namedHandlerClasses.get(config.handler.get()); - handlerStreamClass = namedStreamHandlerClasses.get(config.handler.get()); + if (config.handler().isPresent()) { + handlerClass = namedHandlerClasses.get(config.handler().get()); + handlerStreamClass = namedStreamHandlerClasses.get(config.handler().get()); if (handlerClass == null && handlerStreamClass == null) { - String errorMessage = "Unable to find handler class with name " + config.handler.get() + String errorMessage = "Unable to find handler class with name " + config.handler().get() + " make sure there is a handler class in the deployment with the correct @Named annotation"; throw new RuntimeException(errorMessage); } diff --git a/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/LambdaBuildTimeConfig.java b/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/LambdaBuildTimeConfig.java index 4a035af4fb7ee..5bf355cef4911 100644 --- a/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/LambdaBuildTimeConfig.java +++ b/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/LambdaBuildTimeConfig.java @@ -3,12 +3,13 @@ import java.util.List; 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(name = "lambda", phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) -public class LambdaBuildTimeConfig { +@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) +@ConfigMapping(prefix = "quarkus.lambda") +public interface LambdaBuildTimeConfig { /** * The exception classes expected to be thrown by the handler. @@ -17,6 +18,5 @@ public class LambdaBuildTimeConfig { * but will otherwise be handled normally by the lambda runtime. This is useful for avoiding unnecessary * stack traces while preserving the ability to log unexpected exceptions. */ - @ConfigItem - public Optional>> expectedExceptions; + Optional>> expectedExceptions(); } diff --git a/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/LambdaConfig.java b/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/LambdaConfig.java index 8335b3f3d3a08..0aceb7a4f08ef 100644 --- a/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/LambdaConfig.java +++ b/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/LambdaConfig.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 LambdaConfig { +@ConfigMapping(prefix = "quarkus.lambda") +public interface LambdaConfig { /** * The handler name. Handler names are specified on handler classes using the {@link @jakarta.inject.Named} annotation. @@ -18,6 +19,5 @@ public class LambdaConfig { * then the named handler will be used. * */ - @ConfigItem - public Optional handler; + Optional handler(); }