diff --git a/cdi/pom.xml b/cdi/pom.xml
new file mode 100644
index 000000000..ddcb6bcbd
--- /dev/null
+++ b/cdi/pom.xml
@@ -0,0 +1,110 @@
+
+
+
+
+ 4.0.0
+
+
+ io.smallrye.config
+ smallrye-config-parent
+ 2.0.0-SNAPSHOT
+
+
+ smallrye-config
+
+ SmallRye: MicroProfile Config CDI Implementation
+
+
+
+ io.smallrye.config
+ smallrye-config-core
+
+
+ jakarta.enterprise
+ jakarta.enterprise.cdi-api
+ provided
+
+
+ org.jboss.logging
+ jboss-logging
+
+
+ org.jboss.logging
+ jboss-logging-annotations
+
+
+ org.jboss.logging
+ jboss-logging-processor
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter
+
+
+ org.junit.platform
+ junit-platform-launcher
+ test
+
+
+ org.junit.platform
+ junit-platform-testkit
+ test
+
+
+ org.junit.platform
+ junit-platform-commons
+ test
+
+
+ org.jboss.weld
+ weld-junit5
+
+
+ javax.enterprise
+ cdi-api
+
+
+
+
+
+
+
+ coverage
+
+ @{jacocoArgLine}
+
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ @{jacocoArgLine} -Xmx512m
+
+
+
+
+
+
+
+
diff --git a/implementation/src/main/java/io/smallrye/config/inject/ConfigException.java b/cdi/src/main/java/io/smallrye/config/inject/ConfigException.java
similarity index 99%
rename from implementation/src/main/java/io/smallrye/config/inject/ConfigException.java
rename to cdi/src/main/java/io/smallrye/config/inject/ConfigException.java
index 10ab2b310..9f923d680 100644
--- a/implementation/src/main/java/io/smallrye/config/inject/ConfigException.java
+++ b/cdi/src/main/java/io/smallrye/config/inject/ConfigException.java
@@ -42,4 +42,4 @@ public String getConfigPropertyName() {
return configPropertyName;
}
-}
\ No newline at end of file
+}
diff --git a/implementation/src/main/java/io/smallrye/config/inject/ConfigExtension.java b/cdi/src/main/java/io/smallrye/config/inject/ConfigExtension.java
similarity index 100%
rename from implementation/src/main/java/io/smallrye/config/inject/ConfigExtension.java
rename to cdi/src/main/java/io/smallrye/config/inject/ConfigExtension.java
diff --git a/implementation/src/main/java/io/smallrye/config/inject/ConfigInjectionBean.java b/cdi/src/main/java/io/smallrye/config/inject/ConfigInjectionBean.java
similarity index 100%
rename from implementation/src/main/java/io/smallrye/config/inject/ConfigInjectionBean.java
rename to cdi/src/main/java/io/smallrye/config/inject/ConfigInjectionBean.java
diff --git a/implementation/src/main/java/io/smallrye/config/inject/ConfigMappingInjectionBean.java b/cdi/src/main/java/io/smallrye/config/inject/ConfigMappingInjectionBean.java
similarity index 100%
rename from implementation/src/main/java/io/smallrye/config/inject/ConfigMappingInjectionBean.java
rename to cdi/src/main/java/io/smallrye/config/inject/ConfigMappingInjectionBean.java
diff --git a/implementation/src/main/java/io/smallrye/config/inject/ConfigProducer.java b/cdi/src/main/java/io/smallrye/config/inject/ConfigProducer.java
similarity index 100%
rename from implementation/src/main/java/io/smallrye/config/inject/ConfigProducer.java
rename to cdi/src/main/java/io/smallrye/config/inject/ConfigProducer.java
diff --git a/implementation/src/main/java/io/smallrye/config/inject/ConfigProducerUtil.java b/cdi/src/main/java/io/smallrye/config/inject/ConfigProducerUtil.java
similarity index 100%
rename from implementation/src/main/java/io/smallrye/config/inject/ConfigProducerUtil.java
rename to cdi/src/main/java/io/smallrye/config/inject/ConfigProducerUtil.java
diff --git a/implementation/src/main/java/io/smallrye/config/inject/InjectionMessages.java b/cdi/src/main/java/io/smallrye/config/inject/InjectionMessages.java
similarity index 100%
rename from implementation/src/main/java/io/smallrye/config/inject/InjectionMessages.java
rename to cdi/src/main/java/io/smallrye/config/inject/InjectionMessages.java
diff --git a/implementation/src/main/java/io/smallrye/config/inject/MetadataInjectionPoint.java b/cdi/src/main/java/io/smallrye/config/inject/MetadataInjectionPoint.java
similarity index 100%
rename from implementation/src/main/java/io/smallrye/config/inject/MetadataInjectionPoint.java
rename to cdi/src/main/java/io/smallrye/config/inject/MetadataInjectionPoint.java
diff --git a/implementation/src/main/java/io/smallrye/config/inject/SecuritySupport.java b/cdi/src/main/java/io/smallrye/config/inject/SecuritySupport.java
similarity index 100%
rename from implementation/src/main/java/io/smallrye/config/inject/SecuritySupport.java
rename to cdi/src/main/java/io/smallrye/config/inject/SecuritySupport.java
diff --git a/implementation/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
similarity index 100%
rename from implementation/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
rename to cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
diff --git a/implementation/src/test/java/io/smallrye/config/inject/ConfigInjectionTest.java b/cdi/src/test/java/io/smallrye/config/inject/ConfigInjectionTest.java
similarity index 100%
rename from implementation/src/test/java/io/smallrye/config/inject/ConfigInjectionTest.java
rename to cdi/src/test/java/io/smallrye/config/inject/ConfigInjectionTest.java
diff --git a/implementation/src/test/java/io/smallrye/config/inject/ConfigMappingInjectionTest.java b/cdi/src/test/java/io/smallrye/config/inject/ConfigMappingInjectionTest.java
similarity index 100%
rename from implementation/src/test/java/io/smallrye/config/inject/ConfigMappingInjectionTest.java
rename to cdi/src/test/java/io/smallrye/config/inject/ConfigMappingInjectionTest.java
diff --git a/implementation/src/test/java/io/smallrye/config/inject/InjectedConfigSerializationTest.java b/cdi/src/test/java/io/smallrye/config/inject/InjectedConfigSerializationTest.java
similarity index 98%
rename from implementation/src/test/java/io/smallrye/config/inject/InjectedConfigSerializationTest.java
rename to cdi/src/test/java/io/smallrye/config/inject/InjectedConfigSerializationTest.java
index f053f1bde..4f2c72ef1 100644
--- a/implementation/src/test/java/io/smallrye/config/inject/InjectedConfigSerializationTest.java
+++ b/cdi/src/test/java/io/smallrye/config/inject/InjectedConfigSerializationTest.java
@@ -20,8 +20,6 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import io.smallrye.config.KeyValuesConfigSource;
-
@ExtendWith(WeldJunit5Extension.class)
class InjectedConfigSerializationTest extends InjectionTest {
diff --git a/implementation/src/test/java/io/smallrye/config/inject/InjectionTest.java b/cdi/src/test/java/io/smallrye/config/inject/InjectionTest.java
similarity index 89%
rename from implementation/src/test/java/io/smallrye/config/inject/InjectionTest.java
rename to cdi/src/test/java/io/smallrye/config/inject/InjectionTest.java
index 4ac2e2ea8..a03e92795 100644
--- a/implementation/src/test/java/io/smallrye/config/inject/InjectionTest.java
+++ b/cdi/src/test/java/io/smallrye/config/inject/InjectionTest.java
@@ -15,9 +15,7 @@ public abstract class InjectionTest {
protected static void beforeClass() throws Exception {
final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
final URLClassLoader urlClassLoader = new URLClassLoader(new URL[] {
- new URL("memory", null, 0, "/",
- new InMemoryStreamHandler(
- "io.smallrye.config.inject.InjectionTestConfigFactory"))
+ new URL("memory", null, 0, "/", new InMemoryStreamHandler(InjectionTestConfigFactory.class.getName()))
}, contextClassLoader);
Thread.currentThread().setContextClassLoader(urlClassLoader);
}
diff --git a/implementation/src/test/java/io/smallrye/config/inject/InjectionTestConfigFactory.java b/cdi/src/test/java/io/smallrye/config/inject/InjectionTestConfigFactory.java
similarity index 97%
rename from implementation/src/test/java/io/smallrye/config/inject/InjectionTestConfigFactory.java
rename to cdi/src/test/java/io/smallrye/config/inject/InjectionTestConfigFactory.java
index 3ab66edd1..23837db06 100644
--- a/implementation/src/test/java/io/smallrye/config/inject/InjectionTestConfigFactory.java
+++ b/cdi/src/test/java/io/smallrye/config/inject/InjectionTestConfigFactory.java
@@ -1,6 +1,6 @@
package io.smallrye.config.inject;
-import static io.smallrye.config.KeyValuesConfigSource.config;
+import static io.smallrye.config.inject.KeyValuesConfigSource.config;
import java.util.HashMap;
import java.util.HashSet;
diff --git a/cdi/src/test/java/io/smallrye/config/inject/KeyValuesConfigSource.java b/cdi/src/test/java/io/smallrye/config/inject/KeyValuesConfigSource.java
new file mode 100644
index 000000000..259b58d4d
--- /dev/null
+++ b/cdi/src/test/java/io/smallrye/config/inject/KeyValuesConfigSource.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2017 Red Hat, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package io.smallrye.config.inject;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.microprofile.config.spi.ConfigSource;
+
+public class KeyValuesConfigSource implements ConfigSource, Serializable {
+
+ private final Map properties = new HashMap<>();
+
+ private KeyValuesConfigSource(Map properties) {
+ this.properties.putAll(properties);
+ }
+
+ @Override
+ public Map getProperties() {
+ return Collections.unmodifiableMap(properties);
+ }
+
+ @Override
+ public Set getPropertyNames() {
+ return Collections.unmodifiableSet(properties.keySet());
+ }
+
+ @Override
+ public String getValue(String propertyName) {
+ return properties.get(propertyName);
+ }
+
+ @Override
+ public String getName() {
+ return "KeyValuesConfigSource";
+ }
+
+ public static ConfigSource config(Map properties) {
+ return new KeyValuesConfigSource(properties);
+ }
+
+ public static ConfigSource config(String... keyValues) {
+ if (keyValues.length % 2 != 0) {
+ throw new IllegalArgumentException("keyValues array must be a multiple of 2");
+ }
+
+ Map props = new HashMap<>();
+ for (int i = 0; i < keyValues.length; i += 2) {
+ props.put(keyValues[i], keyValues[i + 1]);
+ }
+ return new KeyValuesConfigSource(props);
+ }
+}
diff --git a/implementation/src/test/java/io/smallrye/config/inject/OptionalInjectionTest.java b/cdi/src/test/java/io/smallrye/config/inject/OptionalInjectionTest.java
similarity index 100%
rename from implementation/src/test/java/io/smallrye/config/inject/OptionalInjectionTest.java
rename to cdi/src/test/java/io/smallrye/config/inject/OptionalInjectionTest.java
diff --git a/implementation/src/test/java/io/smallrye/config/inject/SupplierInjectionTest.java b/cdi/src/test/java/io/smallrye/config/inject/SupplierInjectionTest.java
similarity index 100%
rename from implementation/src/test/java/io/smallrye/config/inject/SupplierInjectionTest.java
rename to cdi/src/test/java/io/smallrye/config/inject/SupplierInjectionTest.java
diff --git a/implementation/src/test/java/io/smallrye/config/inject/ValidateInjectionTest.java b/cdi/src/test/java/io/smallrye/config/inject/ValidateInjectionTest.java
similarity index 100%
rename from implementation/src/test/java/io/smallrye/config/inject/ValidateInjectionTest.java
rename to cdi/src/test/java/io/smallrye/config/inject/ValidateInjectionTest.java
diff --git a/implementation/pom.xml b/implementation/pom.xml
index 5d57ee37c..03924a766 100644
--- a/implementation/pom.xml
+++ b/implementation/pom.xml
@@ -23,20 +23,15 @@
2.0.0-SNAPSHOT
- smallrye-config
+ smallrye-config-core
- SmallRye: MicroProfile Config Implementation
+ SmallRye: MicroProfile Config Core Implementation
org.eclipse.microprofile.config
microprofile-config-api
-
- jakarta.enterprise
- jakarta.enterprise.cdi-api
- provided
-
jakarta.annotation
jakarta.annotation-api
@@ -83,31 +78,6 @@
org.junit.jupiter
junit-jupiter
-
- org.junit.platform
- junit-platform-launcher
- test
-
-
- org.junit.platform
- junit-platform-testkit
- test
-
-
- org.junit.platform
- junit-platform-commons
- test
-
-
- org.jboss.weld
- weld-junit5
-
-
- javax.enterprise
- cdi-api
-
-
-
io.smallrye.testing
smallrye-testing-utilities
diff --git a/implementation/src/main/java/io/smallrye/config/ConfigMappingInterface.java b/implementation/src/main/java/io/smallrye/config/ConfigMappingInterface.java
index f6ae8e99c..12a160876 100644
--- a/implementation/src/main/java/io/smallrye/config/ConfigMappingInterface.java
+++ b/implementation/src/main/java/io/smallrye/config/ConfigMappingInterface.java
@@ -18,7 +18,6 @@
import org.eclipse.microprofile.config.spi.Converter;
import io.smallrye.common.constraint.Assert;
-import io.smallrye.config.inject.InjectionMessages;
/**
* Information about a configuration interface.
@@ -695,7 +694,7 @@ static Class> rawTypeOf(final Type type) {
return Object.class;
}
} else {
- throw InjectionMessages.msg.noRawType(type);
+ throw ConfigMessages.msg.noRawType(type);
}
}
}
diff --git a/implementation/src/main/java/io/smallrye/config/ConfigMessages.java b/implementation/src/main/java/io/smallrye/config/ConfigMessages.java
index 2f5f65819..045dcacc9 100644
--- a/implementation/src/main/java/io/smallrye/config/ConfigMessages.java
+++ b/implementation/src/main/java/io/smallrye/config/ConfigMessages.java
@@ -1,6 +1,7 @@
package io.smallrye.config;
import java.io.InvalidObjectException;
+import java.lang.reflect.Type;
import java.util.NoSuchElementException;
import java.util.regex.Pattern;
@@ -127,4 +128,7 @@ interface ConfigMessages {
@Message(id = 37, value = "The Converter API cannot convert a null value")
NullPointerException converterNullValue();
+
+ @Message(id = 38, value = "Type has no raw type class: %s")
+ IllegalArgumentException noRawType(Type type);
}
diff --git a/pom.xml b/pom.xml
index e536a2539..5ee7650fd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,7 +44,7 @@
SmallRye Config
${project.basedir}/../coverage/target/site/jacoco-aggregate/jacoco.xml
-
+
Apache License, Version 2.0
@@ -67,6 +67,7 @@
common
implementation
+ cdi
sources/hocon
sources/file-system
sources/yaml
@@ -126,6 +127,11 @@
smallrye-config-common
${project.version}
+
+ io.smallrye.config
+ smallrye-config-core
+ ${project.version}
+
io.smallrye.config
smallrye-config