Repository: avaje/avaje-inject
Pull request #190 (2022-03-15 08:14:29)

Bump to Java 11 and migrate to System.Logger from SLF4J-API


Patch:
diff --git a/inject-generator/pom.xml b/inject-generator/pom.xml
index 95db3dc4..586fe73c 100644
--- a/inject-generator/pom.xml
+++ b/inject-generator/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>io.avaje</groupId>
     <artifactId>avaje-inject-parent</artifactId>
-    <version>6.22</version>
+    <version>8.0</version>
   </parent>
 
   <artifactId>avaje-inject-generator</artifactId>
@@ -16,14 +16,14 @@
     <dependency>
       <groupId>io.avaje</groupId>
       <artifactId>avaje-inject</artifactId>
-      <version>6.22</version>
+      <version>8.0</version>
     </dependency>
 
     <!-- test dependencies -->
     <dependency>
       <groupId>io.avaje</groupId>
       <artifactId>junit</artifactId>
-      <version>1.0</version>
+      <version>1.1</version>
       <scope>test</scope>
     </dependency>
 
@@ -38,31 +38,21 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.8.1</version>
         <configuration>
-          <source>1.8</source>
-          <target>1.8</target>
+          <source>11</source>
+          <target>11</target>
           <!-- Turn off annotation processing for building -->
           <compilerArgument>-proc:none</compilerArgument>
         </configuration>
       </plugin>
 
       <plugin>
-        <groupId>org.moditect</groupId>
-        <artifactId>moditect-maven-plugin</artifactId>
-        <version>1.0.0.RC1</version>
-        <executions>
-          <execution>
-            <id>add-module-infos</id>
-            <phase>package</phase>
-            <goals>
-              <goal>add-module-info</goal>
-            </goals>
-            <configuration>
-              <module>
-                <moduleInfoFile>src/main/java9/module-info.java</moduleInfoFile>
-              </module>
-            </configuration>
-          </execution>
-        </executions>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <argLine>
+            --add-opens io.avaje.inject.generator/io.avaje.inject.generator=ALL-UNNAMED
+          </argLine>
+        </configuration>
       </plugin>
 
     </plugins>
diff --git a/inject-generator/src/main/java/io/avaje/inject/generator/MethodReader.java b/inject-generator/src/main/java/io/avaje/inject/generator/MethodReader.java
index e2fe8470..a3ecf6d6 100644
--- a/inject-generator/src/main/java/io/avaje/inject/generator/MethodReader.java
+++ b/inject-generator/src/main/java/io/avaje/inject/generator/MethodReader.java
@@ -146,7 +146,7 @@ class MethodReader {
       }
       if (notEmpty(destroyMethod)) {
         writer.append(indent).append("builder.addPreDestroy($bean::%s);", destroyMethod).eol();
-      } else if (typeReader.isClosable()) {
+      } else if (typeReader != null && typeReader.isClosable()) {
         writer.append(indent).append("builder.addPreDestroy($bean::close);", destroyMethod).eol();
       }
       if (optionalType) {
@@ -156,7 +156,7 @@ class MethodReader {
   }
 
   private boolean hasLifecycleMethods() {
-    return notEmpty(initMethod) || notEmpty(destroyMethod) || typeReader.isClosable();
+    return notEmpty(initMethod) || notEmpty(destroyMethod) || (typeReader != null && typeReader.isClosable());
   }
 
   private boolean notEmpty(String value) {
diff --git a/inject/pom.xml b/inject/pom.xml
index b1fdf540..fb78caf8 100644
--- a/inject/pom.xml
+++ b/inject/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>io.avaje</groupId>
     <artifactId>avaje-inject-parent</artifactId>
-    <version>6.22</version>
+    <version>8.0</version>
   </parent>
 
   <artifactId>avaje-inject</artifactId>
@@ -19,12 +19,6 @@
       <version>2.0.1</version>
     </dependency>
 
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-      <version>1.7.30</version>
-    </dependency>
-
     <dependency>
       <groupId>io.avaje</groupId>
       <artifactId>avaje-lang</artifactId>
@@ -34,7 +28,7 @@
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
-      <version>3.6.0</version>
+      <version>4.3.1</version>
       <optional>true</optional>
     </dependency>
 
@@ -43,7 +37,7 @@
     <dependency>
       <groupId>io.avaje</groupId>
       <artifactId>junit</artifactId>
-      <version>1.0</version>
+      <version>1.1</version>
       <scope>test</scope>
     </dependency>
 
@@ -63,7 +57,6 @@
         <artifactId>maven-javadoc-plugin</artifactId>
         <version>3.2.0</version>
         <configuration>
-<!--          <source>15</source>-->
           <doclint>none</doclint>
           <show>public</show>
           <linksource>true</linksource>
@@ -78,25 +71,18 @@
           </execution>
         </executions>
       </plugin>
+
       <plugin>
-        <groupId>org.moditect</groupId>
-        <artifactId>moditect-maven-plugin</artifactId>
-        <version>1.0.0.RC1</version>
-        <executions>
-          <execution>
-            <id>add-module-infos</id>
-            <phase>package</phase>
-            <goals>
-              <goal>add-module-info</goal>
-            </goals>
-            <configuration>
-              <module>
-                <moduleInfoFile>src/main/java9/module-info.java</moduleInfoFile>
-              </module>
-            </configuration>
-          </execution>
-        </executions>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <argLine>
+            --add-opens io.avaje.inject/io.avaje.inject.spi=ALL-UNNAMED
+            --add-opens io.avaje.inject/io.avaje.inject.aop=ALL-UNNAMED
+          </argLine>
+        </configuration>
       </plugin>
+
     </plugins>
   </build>
 
diff --git a/inject/src/main/java/io/avaje/inject/DBeanScopeBuilder.java b/inject/src/main/java/io/avaje/inject/DBeanScopeBuilder.java
index 476a6be7..9be4d875 100644
--- a/inject/src/main/java/io/avaje/inject/DBeanScopeBuilder.java
+++ b/inject/src/main/java/io/avaje/inject/DBeanScopeBuilder.java
@@ -5,9 +5,8 @@ import io.avaje.inject.spi.EnrichBean;
 import io.avaje.inject.spi.Module;
 import io.avaje.inject.spi.SuppliedBean;
 import io.avaje.lang.Nullable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
+import java.lang.System.Logger.Level;
 import java.lang.reflect.Type;
 import java.util.*;
 import java.util.function.Consumer;
@@ -17,7 +16,7 @@ import java.util.function.Consumer;
  */
 class DBeanScopeBuilder implements BeanScopeBuilder.ForTesting {
 
-  private static final Logger log = LoggerFactory.getLogger("io.avaje.inject");
+  private static final System.Logger log = System.getLogger("io.avaje.inject");
 
   @SuppressWarnings("rawtypes")
   private final List<SuppliedBean> suppliedBeans = new ArrayList<>();
@@ -150,7 +149,7 @@ class DBeanScopeBuilder implements BeanScopeBuilder.ForTesting {
         " Review IntelliJ Settings / Build / Build tools / Gradle - 'Build and run using' value and set that to 'Gradle'. " +
         " Refer to https://avaje.io/inject#gradle");
     }
-    log.debug("building with modules {}", moduleNames);
+    log.log(Level.DEBUG, "building with modules {0}", moduleNames);
     Builder builder = Builder.newBuilder(suppliedBeans, enrichBeans, parent, parentOverride);
     for (Module factory : factoryOrder.factories()) {
       factory.build(builder);
diff --git a/inject/src/main/java/io/avaje/inject/spi/DBeanScope.java b/inject/src/main/java/io/avaje/inject/spi/DBeanScope.java
index a41a7b4a..19a8e73d 100644
--- a/inject/src/main/java/io/avaje/inject/spi/DBeanScope.java
+++ b/inject/src/main/java/io/avaje/inject/spi/DBeanScope.java
@@ -5,9 +5,9 @@ import io.avaje.inject.BeanScope;
 import io.avaje.inject.Priority;
 import io.avaje.lang.NonNullApi;
 import io.avaje.lang.Nullable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
+
+import java.lang.System.Logger.Level;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 import java.util.*;
@@ -16,7 +16,7 @@ import java.util.concurrent.locks.ReentrantLock;
 @NonNullApi
 class DBeanScope implements BeanScope {
 
-  private static final Logger log = LoggerFactory.getLogger("io.avaje.inject");
+  private static final System.Logger log = System.getLogger("io.avaje.inject");
 
   private final ReentrantLock lock = new ReentrantLock();
   private final List<Runnable> postConstruct;
@@ -173,7 +173,7 @@ class DBeanScope implements BeanScope {
   DBeanScope start() {
     lock.lock();
     try {
-      log.trace("firing postConstruct");
+      log.log(Level.TRACE, "firing postConstruct");
       for (Runnable invoke : postConstruct) {
         invoke.run();
       }
@@ -193,12 +193,12 @@ class DBeanScope implements BeanScope {
       if (!closed) {
         // we only allow one call to preDestroy
         closed = true;
-        log.trace("firing preDestroy");
+        log.log(Level.TRACE, "firing preDestroy");
         for (AutoCloseable closeable : preDestroy) {
           try {
             closeable.close();
           } catch (Exception e) {
-            log.error("Error during PreDestroy lifecycle method", e);
+            log.log(Level.ERROR, "Error during PreDestroy lifecycle method", e);
           }
         }
       }
diff --git a/inject/src/main/java9/module-info.java b/inject/src/main/java/module-info.java
similarity index 73%
rename from inject/src/main/java9/module-info.java
rename to inject/src/main/java/module-info.java
index c9465dff..c2c6b7e1 100644
--- a/inject/src/main/java9/module-info.java
+++ b/inject/src/main/java/module-info.java
@@ -1,10 +1,11 @@
 module io.avaje.inject {
 
   exports io.avaje.inject;
+  exports io.avaje.inject.aop;
   exports io.avaje.inject.spi;
 
+  requires transitive io.avaje.lang;
   requires transitive jakarta.inject;
-  requires transitive org.slf4j;
   requires static org.mockito;
 
   uses io.avaje.inject.spi.Module;
diff --git a/pom.xml b/pom.xml
index 24d56fc0..eaa62f6f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,13 +3,13 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.avaje</groupId>
-    <artifactId>java8-oss</artifactId>
-    <version>3.4</version>
+    <artifactId>java11-oss</artifactId>
+    <version>3.6</version>
   </parent>
 
   <groupId>io.avaje</groupId>
   <artifactId>avaje-inject-parent</artifactId>
-  <version>6.22</version>
+  <version>8.0</version>
   <packaging>pom</packaging>
   <name>avaje inject parent</name>
   <description>parent pom for avaje inject library</description>


Test patch:
diff --git a/blackbox-test-inject/pom.xml b/blackbox-test-inject/pom.xml
index fb18b46c..6ac02c88 100644
--- a/blackbox-test-inject/pom.xml
+++ b/blackbox-test-inject/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <artifactId>avaje-inject-parent</artifactId>
     <groupId>io.avaje</groupId>
-    <version>6.22</version>
+    <version>8.0</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
@@ -55,7 +55,7 @@
     <dependency>
       <groupId>io.avaje</groupId>
       <artifactId>junit</artifactId>
-      <version>1.0</version>
+      <version>1.1</version>
       <scope>test</scope>
     </dependency>
 
@@ -68,16 +68,4 @@
 
   </dependencies>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-deploy-plugin</artifactId>
-        <configuration>
-          <skip>true</skip>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
 </project>
diff --git a/inject-generator/src/main/java9/module-info.java b/inject-generator/src/main/java/module-info.java
similarity index 100%
rename from inject-generator/src/main/java9/module-info.java
rename to inject-generator/src/main/java/module-info.java
diff --git a/inject-test/pom.xml b/inject-test/pom.xml
index a6540eef..eb884165 100644
--- a/inject-test/pom.xml
+++ b/inject-test/pom.xml
@@ -4,14 +4,14 @@
   <parent>
     <groupId>io.avaje</groupId>
     <artifactId>avaje-inject-parent</artifactId>
-    <version>6.22</version>
+    <version>8.0</version>
   </parent>
 
   <artifactId>avaje-inject-test</artifactId>
 
   <properties>
-    <jupiter.version>5.8.0</jupiter.version>
-    <mockito.version>3.12.4</mockito.version>
+    <jupiter.version>5.8.2</jupiter.version>
+    <mockito.version>4.4.0</mockito.version>
   </properties>
 
   <dependencies>
@@ -46,12 +46,6 @@
       <version>${mockito.version}</version>
     </dependency>
 
-    <dependency>
-      <groupId>io.avaje</groupId>
-      <artifactId>avaje-inject-generator</artifactId>
-      <version>${project.version}</version>
-      <scope>provided</scope>
-    </dependency>
 
     <!-- test dependencies -->
     <dependency>
@@ -113,7 +107,7 @@
     <dependency>
       <groupId>io.avaje</groupId>
       <artifactId>junit</artifactId>
-      <version>1.0</version>
+      <version>1.1</version>
       <scope>test</scope>
     </dependency>
 
@@ -123,12 +117,26 @@
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-deploy-plugin</artifactId>
+        <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-          <skip>true</skip>
+          <release>${java.release}</release>
+          <annotationProcessorPaths>
+            <path>
+              <groupId>io.avaje</groupId>
+              <artifactId>avaje-inject-generator</artifactId>
+              <version>8.0</version>
+            </path>
+          </annotationProcessorPaths>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <useModulePath>false</useModulePath>
         </configuration>
       </plugin>
     </plugins>
   </build>
-
 </project>
diff --git a/inject-test/src/main/java/io/avaje/inject/test/InjectExtension.java b/inject-test/src/main/java/io/avaje/inject/test/InjectExtension.java
index 0d264ef7..d8c2f13d 100644
--- a/inject-test/src/main/java/io/avaje/inject/test/InjectExtension.java
+++ b/inject-test/src/main/java/io/avaje/inject/test/InjectExtension.java
@@ -7,9 +7,10 @@ import org.junit.jupiter.api.extension.BeforeAllCallback;
 import org.junit.jupiter.api.extension.BeforeEachCallback;
 import org.junit.jupiter.api.extension.ExtensionContext;
 import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
+import java.io.*;
+import java.lang.System.Logger.Level;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -23,7 +24,7 @@ import java.util.concurrent.locks.ReentrantLock;
  */
 public class InjectExtension implements BeforeAllCallback, BeforeEachCallback, AfterEachCallback, ExtensionContext.Store.CloseableResource {
 
-  private static final Logger log = LoggerFactory.getLogger(InjectExtension.class);
+  private static final System.Logger log = System.getLogger("io.avaje.inject");
   private static final Namespace INJECT_NS = Namespace.create("io.avaje.inject.InjectTest");
   private static final String BEAN_SCOPE = "BEAN_SCOPE";
   private static final ReentrantLock lock = new ReentrantLock();
@@ -44,11 +45,11 @@ public class InjectExtension implements BeforeAllCallback, BeforeEachCallback, A
   }
 
   @Override
-  public void close() throws Throwable {
+  public void close() {
     lock.lock();
     try {
       if (globalTestScope != null) {
-        log.debug("Closing global test BeanScope");
+        log.log(Level.DEBUG, "Closing global test BeanScope");
         globalTestScope.close();
       }
     } finally {
@@ -59,14 +60,49 @@ public class InjectExtension implements BeforeAllCallback, BeforeEachCallback, A
   private void initialiseGlobalTestScope(ExtensionContext context) {
     Iterator<TestModule> iterator = ServiceLoader.load(TestModule.class).iterator();
     if (iterator.hasNext()) {
-      log.debug("Building global test BeanScope (as parent scope for tests)");
-      globalTestScope = BeanScope.newBuilder()
-        .withModules(iterator.next())
-        .build();
+      registerTestModule(context, iterator.next());
+    } else {
+      registerViaResources(context);
+    }
+  }
 
-      log.trace("register global test BeanScope with beans {}", globalTestScope);
-      context.getRoot().getStore(Namespace.GLOBAL).put(InjectExtension.class.getCanonicalName(), this);
+  private void registerTestModule(ExtensionContext context, TestModule testModule) {
+    log.log(Level.DEBUG, "Building global test BeanScope (as parent scope for tests)");
+    globalTestScope = BeanScope.newBuilder()
+      .withModules(testModule)
+      .build();
+
+    log.log(Level.TRACE, "register global test BeanScope with beans %s", globalTestScope);
+    context.getRoot().getStore(Namespace.GLOBAL).put(InjectExtension.class.getCanonicalName(), this);
+  }
+
+  /**
+   * Fallback when ServiceLoader does not work in module-path for generated test service.
+   */
+  private void registerViaResources(ExtensionContext context) {
+    try {
+      URL url = ClassLoader.getSystemResource("META-INF/services/io.avaje.inject.test.TestModule");
+      String className = readServiceClassName(url);
+      if (className != null) {
+        Class<?> cls = Class.forName(className);
+        TestModule testModule = (TestModule) cls.getDeclaredConstructor().newInstance();
+        registerTestModule(context, testModule);
+      }
+    } catch (Throwable e) {
+      throw new RuntimeException("Error trying to create TestModule", e);
+    }
+  }
+
+  private String readServiceClassName(URL url) throws IOException {
+    if (url != null) {
+      InputStream is = url.openStream();
+      if (is != null) {
+        try (LineNumberReader lineNumberReader = new LineNumberReader(new InputStreamReader(is))) {
+          return lineNumberReader.readLine();
+        }
+      }
     }
+    return null;
   }
 
   /**
@@ -90,7 +126,7 @@ public class InjectExtension implements BeforeAllCallback, BeforeEachCallback, A
     for (MetaReader reader : readers) {
       reader.setFromScope(beanScope);
     }
-    log.trace("test setup with {}", readers);
+    log.log(Level.TRACE, "test setup with %s", readers);
     context.getStore(INJECT_NS).put(BEAN_SCOPE, beanScope);
   }
 
diff --git a/inject-test/src/main/java/module-info.java b/inject-test/src/main/java/module-info.java
new file mode 100644
index 00000000..aa1459e2
--- /dev/null
+++ b/inject-test/src/main/java/module-info.java
@@ -0,0 +1,14 @@
+module io.avaje.inject.test {
+
+  exports io.avaje.inject.test;
+
+  requires transitive io.avaje.inject;
+  requires transitive org.junit.jupiter.engine;
+  requires transitive org.junit.jupiter.api;
+  requires transitive org.mockito;
+  requires transitive org.mockito.junit.jupiter;
+//  requires transitive org.assertj.core;
+//  requires transitive net.bytebuddy;
+
+  uses io.avaje.inject.test.TestModule;
+}
diff --git a/inject-test/src/test/java/io/avaje/inject/spi/DContextEntryTest.java b/inject-test/src/test/java/io/avaje/inject/spi/DContextEntryTest.java
deleted file mode 100644
index 80d7cd12..00000000
--- a/inject-test/src/test/java/io/avaje/inject/spi/DContextEntryTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package io.avaje.inject.spi;
-
-import io.avaje.inject.BeanEntry;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-public class DContextEntryTest {
-
-  @Test
-  public void get_when_onePrimary() {
-
-    DContextEntry entry = new DContextEntry();
-    entry.add(DContextEntryBean.of("P", null, BeanEntry.PRIMARY));
-    entry.add(DContextEntryBean.of("N", null, BeanEntry.NORMAL));
-    entry.add(DContextEntryBean.of("S", null, BeanEntry.SECONDARY));
-
-    assertEquals(entry.get(null), "P");
-  }
-
-  @Test
-  public void get_when_twoPrimary() {
-    assertThrows(IllegalStateException.class, () -> {
-      DContextEntry entry = new DContextEntry();
-      entry.add(DContextEntryBean.of("P", null, BeanEntry.PRIMARY));
-      entry.add(DContextEntryBean.of("N", null, BeanEntry.NORMAL));
-      entry.add(DContextEntryBean.of("S", null, BeanEntry.PRIMARY));
-
-      entry.get(null);
-    });
-  }
-
-  @Test
-  public void get_when_oneNormal() {
-
-    DContextEntry entry = new DContextEntry();
-    entry.add(DContextEntryBean.of("N", null, BeanEntry.NORMAL));
-    entry.add(DContextEntryBean.of("S", null, BeanEntry.SECONDARY));
-
-    assertEquals(entry.get(null), "N");
-  }
-
-
-  @Test
-  public void get_when_oneNormal2() {
-
-    DContextEntry entry = new DContextEntry();
-    entry.add(DContextEntryBean.of("N", null, BeanEntry.NORMAL));
-    entry.add(DContextEntryBean.of("S1", null, BeanEntry.SECONDARY));
-    entry.add(DContextEntryBean.of("S2", null, BeanEntry.SECONDARY));
-
-    assertEquals(entry.get(null), "N");
-  }
-
-  @Test
-  public void get_when_multiSecondaryOnly() {
-    assertThrows(IllegalStateException.class, () -> {
-      DContextEntry entry = new DContextEntry();
-      entry.add(DContextEntryBean.of("S1", null, BeanEntry.SECONDARY));
-      entry.add(DContextEntryBean.of("S2", null, BeanEntry.SECONDARY));
-
-      entry.get(null);
-    });
-  }
-
-
-  @Test
-  public void get_when_multiSecondary_butNamed() {
-
-    DContextEntry entry = new DContextEntry();
-    entry.add(DContextEntryBean.of("S1", "a", BeanEntry.SECONDARY));
-    entry.add(DContextEntryBean.of("S2", "b", BeanEntry.SECONDARY));
-
-    assertEquals(entry.get("b"), "S2");
-  }
-
-  @Test
-  public void get_when_multiSecondary_butNamed2() {
-
-    DContextEntry entry = new DContextEntry();
-    entry.add(DContextEntryBean.of("S1", null, BeanEntry.SECONDARY));
-    entry.add(DContextEntryBean.of("S2", "b", BeanEntry.SECONDARY));
-
-    assertEquals(entry.get("b"), "S2");
-  }
-
-  @Test
-  public void get_when_secondary_butNamed() {
-
-    DContextEntry entry = new DContextEntry();
-    entry.add(DContextEntryBean.of("S1", null, BeanEntry.PRIMARY));
-    entry.add(DContextEntryBean.of("S2", "b", BeanEntry.SECONDARY));
-
-    assertEquals(entry.get("b"), "S2");
-  }
-}
diff --git a/inject-test/src/test/java/io/avaje/inject/ApplicationScope.java b/inject-test/src/test/java/io/avaje/inject/xtra/ApplicationScope.java
similarity index 98%
rename from inject-test/src/test/java/io/avaje/inject/ApplicationScope.java
rename to inject-test/src/test/java/io/avaje/inject/xtra/ApplicationScope.java
index 7d722d75..da02664e 100644
--- a/inject-test/src/test/java/io/avaje/inject/ApplicationScope.java
+++ b/inject-test/src/test/java/io/avaje/inject/xtra/ApplicationScope.java
@@ -1,4 +1,6 @@
-package io.avaje.inject;
+package io.avaje.inject.xtra;
+
+import io.avaje.inject.BeanScope;
 
 import java.util.List;
 
diff --git a/inject-test/src/test/java/io/avaje/inject/SystemContextTest.java b/inject-test/src/test/java/io/avaje/inject/xtra/SystemContextTest.java
similarity index 96%
rename from inject-test/src/test/java/io/avaje/inject/SystemContextTest.java
rename to inject-test/src/test/java/io/avaje/inject/xtra/SystemContextTest.java
index 57b6cdad..5c463ce0 100644
--- a/inject-test/src/test/java/io/avaje/inject/SystemContextTest.java
+++ b/inject-test/src/test/java/io/avaje/inject/xtra/SystemContextTest.java
@@ -1,5 +1,6 @@
-package io.avaje.inject;
+package io.avaje.inject.xtra;
 
+import io.avaje.inject.BeanScope;
 import org.example.coffee.fruit.Fruit;
 import org.example.coffee.list.A2Somei;
 import org.example.coffee.list.ASomei;
diff --git a/inject-test/src/test/java/org/example/circular/CupholderTest.java b/inject-test/src/test/java/org/example/circular/CupholderTest.java
index c804247a..8984ef0c 100644
--- a/inject-test/src/test/java/org/example/circular/CupholderTest.java
+++ b/inject-test/src/test/java/org/example/circular/CupholderTest.java
@@ -1,6 +1,6 @@
 package org.example.circular;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/coffee/factory/MultipleOtherThingsTest.java b/inject-test/src/test/java/org/example/coffee/factory/MultipleOtherThingsTest.java
index e1b8fd4d..71ac88f4 100644
--- a/inject-test/src/test/java/org/example/coffee/factory/MultipleOtherThingsTest.java
+++ b/inject-test/src/test/java/org/example/coffee/factory/MultipleOtherThingsTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.factory;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import io.avaje.inject.BeanScope;
 import org.junit.jupiter.api.Test;
 
diff --git a/inject-test/src/test/java/org/example/coffee/factory/MyFactoryTest.java b/inject-test/src/test/java/org/example/coffee/factory/MyFactoryTest.java
index 7353efb8..5099339c 100644
--- a/inject-test/src/test/java/org/example/coffee/factory/MyFactoryTest.java
+++ b/inject-test/src/test/java/org/example/coffee/factory/MyFactoryTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.factory;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import io.avaje.inject.BeanScope;
 import org.example.coffee.parent.DesEngi;
 import org.junit.jupiter.api.Test;
diff --git a/inject-test/src/test/java/org/example/coffee/generic/HazManagerTest.java b/inject-test/src/test/java/org/example/coffee/generic/HazManagerTest.java
index 5508004b..04fb15ca 100644
--- a/inject-test/src/test/java/org/example/coffee/generic/HazManagerTest.java
+++ b/inject-test/src/test/java/org/example/coffee/generic/HazManagerTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.generic;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import io.avaje.inject.BeanScope;
 import org.junit.jupiter.api.Test;
 
diff --git a/inject-test/src/test/java/org/example/coffee/generic/MultiGenericConsumerTest.java b/inject-test/src/test/java/org/example/coffee/generic/MultiGenericConsumerTest.java
index 4916b439..33bafb5d 100644
--- a/inject-test/src/test/java/org/example/coffee/generic/MultiGenericConsumerTest.java
+++ b/inject-test/src/test/java/org/example/coffee/generic/MultiGenericConsumerTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.generic;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/coffee/parent/ConcreteEngiTest.java b/inject-test/src/test/java/org/example/coffee/parent/ConcreteEngiTest.java
index 2134c192..1a7c74f2 100644
--- a/inject-test/src/test/java/org/example/coffee/parent/ConcreteEngiTest.java
+++ b/inject-test/src/test/java/org/example/coffee/parent/ConcreteEngiTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.parent;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.example.coffee.parent.sub.Engi;
 import org.example.coffee.parent.sub.PetEngi;
 import org.junit.jupiter.api.Test;
diff --git a/inject-test/src/test/java/org/example/coffee/parent/ConcreteParentTest.java b/inject-test/src/test/java/org/example/coffee/parent/ConcreteParentTest.java
index e4e6310a..acd4d7c3 100644
--- a/inject-test/src/test/java/org/example/coffee/parent/ConcreteParentTest.java
+++ b/inject-test/src/test/java/org/example/coffee/parent/ConcreteParentTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.parent;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/coffee/primary/UseNamedPEmailerTest.java b/inject-test/src/test/java/org/example/coffee/primary/UseNamedPEmailerTest.java
index 889543ad..76dc2e70 100644
--- a/inject-test/src/test/java/org/example/coffee/primary/UseNamedPEmailerTest.java
+++ b/inject-test/src/test/java/org/example/coffee/primary/UseNamedPEmailerTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.primary;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/coffee/primary/UserOfPEmailerTest.java b/inject-test/src/test/java/org/example/coffee/primary/UserOfPEmailerTest.java
index 896ffabc..7cdcdb53 100644
--- a/inject-test/src/test/java/org/example/coffee/primary/UserOfPEmailerTest.java
+++ b/inject-test/src/test/java/org/example/coffee/primary/UserOfPEmailerTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.primary;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/coffee/priority/base/PriorityTest.java b/inject-test/src/test/java/org/example/coffee/priority/base/PriorityTest.java
index c62bdc3c..d0b13c86 100644
--- a/inject-test/src/test/java/org/example/coffee/priority/base/PriorityTest.java
+++ b/inject-test/src/test/java/org/example/coffee/priority/base/PriorityTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.priority.base;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import java.util.List;
diff --git a/inject-test/src/test/java/org/example/coffee/priority/custom/CustomPriorityTest.java b/inject-test/src/test/java/org/example/coffee/priority/custom/CustomPriorityTest.java
index 233d67b9..cccad32d 100644
--- a/inject-test/src/test/java/org/example/coffee/priority/custom/CustomPriorityTest.java
+++ b/inject-test/src/test/java/org/example/coffee/priority/custom/CustomPriorityTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.priority.custom;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import io.avaje.inject.BeanScope;
 import org.junit.jupiter.api.Test;
 
diff --git a/inject-test/src/test/java/org/example/coffee/provider/FieldInjectProviderTest.java b/inject-test/src/test/java/org/example/coffee/provider/FieldInjectProviderTest.java
index bee087dd..347b5ab4 100644
--- a/inject-test/src/test/java/org/example/coffee/provider/FieldInjectProviderTest.java
+++ b/inject-test/src/test/java/org/example/coffee/provider/FieldInjectProviderTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.provider;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/coffee/provider/MethodInjectProviderTest.java b/inject-test/src/test/java/org/example/coffee/provider/MethodInjectProviderTest.java
index 9b45c6c3..bfb9ab81 100644
--- a/inject-test/src/test/java/org/example/coffee/provider/MethodInjectProviderTest.java
+++ b/inject-test/src/test/java/org/example/coffee/provider/MethodInjectProviderTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.provider;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/coffee/qualifier/FooQualTest.java b/inject-test/src/test/java/org/example/coffee/qualifier/FooQualTest.java
index 6c7869cb..5ac7f433 100644
--- a/inject-test/src/test/java/org/example/coffee/qualifier/FooQualTest.java
+++ b/inject-test/src/test/java/org/example/coffee/qualifier/FooQualTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.qualifier;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/coffee/secondary/SecondaryEmailerTest.java b/inject-test/src/test/java/org/example/coffee/secondary/SecondaryEmailerTest.java
index 0eed2a3a..a3c82b9f 100644
--- a/inject-test/src/test/java/org/example/coffee/secondary/SecondaryEmailerTest.java
+++ b/inject-test/src/test/java/org/example/coffee/secondary/SecondaryEmailerTest.java
@@ -1,6 +1,6 @@
 package org.example.coffee.secondary;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/generic/PathBuildTaskTest.java b/inject-test/src/test/java/org/example/generic/PathBuildTaskTest.java
index 275c0248..35d04ec6 100644
--- a/inject-test/src/test/java/org/example/generic/PathBuildTaskTest.java
+++ b/inject-test/src/test/java/org/example/generic/PathBuildTaskTest.java
@@ -3,6 +3,8 @@ package org.example.generic;
 import io.avaje.inject.BeanScope;
 import org.junit.jupiter.api.Test;
 
+import java.util.Optional;
+
 import static org.assertj.core.api.Assertions.assertThat;
 
 class PathBuildTaskTest {
diff --git a/inject-test/src/test/java/org/example/iface/NestedInterfaceTest.java b/inject-test/src/test/java/org/example/iface/NestedInterfaceTest.java
index 68864d70..2d7a7de8 100644
--- a/inject-test/src/test/java/org/example/iface/NestedInterfaceTest.java
+++ b/inject-test/src/test/java/org/example/iface/NestedInterfaceTest.java
@@ -1,6 +1,6 @@
 package org.example.iface;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import io.avaje.inject.BeanScope;
 import org.junit.jupiter.api.Test;
 
diff --git a/inject-test/src/test/java/org/example/inherit/InhOneTest.java b/inject-test/src/test/java/org/example/inherit/InhOneTest.java
index 0a1e1e2e..b60d2e19 100644
--- a/inject-test/src/test/java/org/example/inherit/InhOneTest.java
+++ b/inject-test/src/test/java/org/example/inherit/InhOneTest.java
@@ -1,6 +1,6 @@
 package org.example.inherit;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/missing/MFooTest.java b/inject-test/src/test/java/org/example/missing/MFooTest.java
index 95cbfc6a..6d816be4 100644
--- a/inject-test/src/test/java/org/example/missing/MFooTest.java
+++ b/inject-test/src/test/java/org/example/missing/MFooTest.java
@@ -1,6 +1,6 @@
 package org.example.missing;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/missing/SinglePublicConstructorTest.java b/inject-test/src/test/java/org/example/missing/SinglePublicConstructorTest.java
index c7c66746..bf4bb499 100644
--- a/inject-test/src/test/java/org/example/missing/SinglePublicConstructorTest.java
+++ b/inject-test/src/test/java/org/example/missing/SinglePublicConstructorTest.java
@@ -1,6 +1,6 @@
 package org.example.missing;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/optional/NoImpUserTest.java b/inject-test/src/test/java/org/example/optional/NoImpUserTest.java
index 8e567ee6..85473c65 100644
--- a/inject-test/src/test/java/org/example/optional/NoImpUserTest.java
+++ b/inject-test/src/test/java/org/example/optional/NoImpUserTest.java
@@ -1,6 +1,6 @@
 package org.example.optional;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/optional/OptionalFactoryTest.java b/inject-test/src/test/java/org/example/optional/OptionalFactoryTest.java
index e759c9db..ddbc59af 100644
--- a/inject-test/src/test/java/org/example/optional/OptionalFactoryTest.java
+++ b/inject-test/src/test/java/org/example/optional/OptionalFactoryTest.java
@@ -1,6 +1,6 @@
 package org.example.optional;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
diff --git a/inject-test/src/test/java/org/example/request/AWebRouteTest.java b/inject-test/src/test/java/org/example/request/AWebRouteTest.java
index ea571b91..4167d574 100644
--- a/inject-test/src/test/java/org/example/request/AWebRouteTest.java
+++ b/inject-test/src/test/java/org/example/request/AWebRouteTest.java
@@ -1,7 +1,7 @@
 package org.example.request;
 
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import io.javalin.http.Context;
 import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
diff --git a/inject-test/src/test/java/org/example/request/BWebRouteTest.java b/inject-test/src/test/java/org/example/request/BWebRouteTest.java
index 3f015143..6cf4e214 100644
--- a/inject-test/src/test/java/org/example/request/BWebRouteTest.java
+++ b/inject-test/src/test/java/org/example/request/BWebRouteTest.java
@@ -1,7 +1,7 @@
 package org.example.request;
 
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import io.helidon.webserver.ServerRequest;
 import io.helidon.webserver.ServerResponse;
 import org.junit.jupiter.api.Test;
diff --git a/inject-test/src/test/java/org/example/request/JexControllerTest.java b/inject-test/src/test/java/org/example/request/JexControllerTest.java
index eb72ef2f..33f71514 100644
--- a/inject-test/src/test/java/org/example/request/JexControllerTest.java
+++ b/inject-test/src/test/java/org/example/request/JexControllerTest.java
@@ -1,6 +1,6 @@
 package org.example.request;
 
-import io.avaje.inject.ApplicationScope;
+import io.avaje.inject.xtra.ApplicationScope;
 import io.avaje.jex.Context;
 import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;