From beaf972c31454578bab96e7df9766442d8cc6762 Mon Sep 17 00:00:00 2001 From: Markus Jung Date: Mon, 11 Nov 2024 15:35:23 +0100 Subject: [PATCH] fix #1246: honor ConfigProperties.UNCONFIGURED_PREFIX again --- .../java/io/smallrye/config/inject/ConfigExtension.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cdi/src/main/java/io/smallrye/config/inject/ConfigExtension.java b/cdi/src/main/java/io/smallrye/config/inject/ConfigExtension.java index 5bbd60451..1f110375f 100644 --- a/cdi/src/main/java/io/smallrye/config/inject/ConfigExtension.java +++ b/cdi/src/main/java/io/smallrye/config/inject/ConfigExtension.java @@ -99,10 +99,15 @@ protected void processConfigProperties( // We are going to veto, because it may be a managed bean, and we will use a configurator bean processAnnotatedType.veto(); + // Unconfigured is represented as an empty String in SmallRye Config + String prefix = annotatedType.getAnnotation(ConfigProperties.class).prefix(); + if (ConfigProperties.UNCONFIGURED_PREFIX.equals(prefix)) { + prefix = ""; + } + // Each config class is both in SmallRyeConfig and managed by a configurator bean. // CDI requires more beans for injection points due to binding prefix. - ConfigClass properties = ConfigClass.configClass(annotatedType.getJavaClass(), - annotatedType.getAnnotation(ConfigProperties.class).prefix()); + ConfigClass properties = ConfigClass.configClass(annotatedType.getJavaClass(), prefix); configProperties.add(properties); configPropertiesBeans.add(properties); }