Repository: avaje/avaje-inject
Pull request #600 (2024-06-10 02:53:39)

Split Events into their own module
- changes `event` package to `events`
- moves everything into its own module and adds as a transitive dep to inject
- changes generation to directly register an `Observer`


Patch:
diff --git a/blackbox-aspect/pom.xml b/blackbox-aspect/pom.xml
index 6bd65672..dc093241 100644
--- a/blackbox-aspect/pom.xml
+++ b/blackbox-aspect/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <artifactId>avaje-inject-parent</artifactId>
     <groupId>io.avaje</groupId>
-    <version>10.0-RC5</version>
+    <version>10.0-RC6</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
@@ -34,5 +34,4 @@
     </dependency>
 
   </dependencies>
-
 </project>
diff --git a/blackbox-other/pom.xml b/blackbox-other/pom.xml
index 79789aae..372555f2 100644
--- a/blackbox-other/pom.xml
+++ b/blackbox-other/pom.xml
@@ -6,7 +6,7 @@
   <parent>
     <artifactId>avaje-inject-parent</artifactId>
     <groupId>io.avaje</groupId>
-    <version>10.0-RC5</version>
+    <version>10.0-RC6</version>
   </parent>
 
   <artifactId>blackbox-other</artifactId>
diff --git a/blackbox-other/src/main/java/org/other/one/events/SomeOptionalDep$Publisher.java b/blackbox-other/src/main/java/org/other/one/events/SomeOptionalDep$Publisher.java
index 5d5eeb02..27d36e43 100644
--- a/blackbox-other/src/main/java/org/other/one/events/SomeOptionalDep$Publisher.java
+++ b/blackbox-other/src/main/java/org/other/one/events/SomeOptionalDep$Publisher.java
@@ -1,12 +1,14 @@
 package org.other.one.events;
 
-import io.avaje.inject.Component;
-import io.avaje.inject.event.Event;
-import io.avaje.inject.event.ObserverManager;
-import io.avaje.inject.spi.Generated;
 import java.lang.reflect.Type;
+
 import org.other.one.SomeOptionalDep;
 
+import io.avaje.inject.Component;
+import io.avaje.inject.events.Event;
+import io.avaje.inject.events.ObserverManager;
+import io.avaje.inject.spi.Generated;
+
 @Component
 @Generated("avaje-inject-generator")
 public class SomeOptionalDep$Publisher extends Event<SomeOptionalDep> {
diff --git a/inject-events/pom.xml b/inject-events/pom.xml
new file mode 100644
index 00000000..be413ef1
--- /dev/null
+++ b/inject-events/pom.xml
@@ -0,0 +1,32 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>io.avaje</groupId>
+    <artifactId>avaje-inject-parent</artifactId>
+    <version>10.0-RC6</version>
+  </parent>
+  <artifactId>avaje-inject-events</artifactId>
+  <name>avaje inject events</name>
+  <description>avaje-inject events plugins for event publishing/consuming</description>
+  <dependencies>
+    <dependency>
+      <groupId>io.avaje</groupId>
+      <artifactId>avaje-inject</artifactId>
+      <version>10.0-RC5</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>io.avaje</groupId>
+      <artifactId>avaje-spi-service</artifactId>
+      <version>1.9</version>
+      <scope>provided</scope>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>io.avaje</groupId>
+      <artifactId>junit</artifactId>
+      <version>1.4</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file
diff --git a/inject/src/main/java/io/avaje/inject/event/Event.java b/inject-events/src/main/java/io/avaje/inject/events/Event.java
similarity index 99%
rename from inject/src/main/java/io/avaje/inject/event/Event.java
rename to inject-events/src/main/java/io/avaje/inject/events/Event.java
index 9ef1974e..ef4ad7c0 100644
--- a/inject/src/main/java/io/avaje/inject/event/Event.java
+++ b/inject-events/src/main/java/io/avaje/inject/events/Event.java
@@ -1,4 +1,4 @@
-package io.avaje.inject.event;
+package io.avaje.inject.events;
 
 import java.lang.reflect.Type;
 import java.util.ArrayList;
diff --git a/inject/src/main/java/io/avaje/inject/event/Observer.java b/inject-events/src/main/java/io/avaje/inject/events/Observer.java
similarity index 96%
rename from inject/src/main/java/io/avaje/inject/event/Observer.java
rename to inject-events/src/main/java/io/avaje/inject/events/Observer.java
index da93d4b4..850a2d89 100644
--- a/inject/src/main/java/io/avaje/inject/event/Observer.java
+++ b/inject-events/src/main/java/io/avaje/inject/events/Observer.java
@@ -1,4 +1,4 @@
-package io.avaje.inject.event;
+package io.avaje.inject.events;
 
 import java.util.function.Consumer;
 
diff --git a/inject/src/main/java/io/avaje/inject/event/ObserverManager.java b/inject-events/src/main/java/io/avaje/inject/events/ObserverManager.java
similarity index 96%
rename from inject/src/main/java/io/avaje/inject/event/ObserverManager.java
rename to inject-events/src/main/java/io/avaje/inject/events/ObserverManager.java
index f7c59b66..762a1bdd 100644
--- a/inject/src/main/java/io/avaje/inject/event/ObserverManager.java
+++ b/inject-events/src/main/java/io/avaje/inject/events/ObserverManager.java
@@ -1,4 +1,4 @@
-package io.avaje.inject.event;
+package io.avaje.inject.events;
 
 import java.lang.reflect.Type;
 import java.util.List;
diff --git a/inject/src/main/java/io/avaje/inject/event/Observes.java b/inject-events/src/main/java/io/avaje/inject/events/Observes.java
similarity index 98%
rename from inject/src/main/java/io/avaje/inject/event/Observes.java
rename to inject-events/src/main/java/io/avaje/inject/events/Observes.java
index 38b85a4c..59ab8605 100644
--- a/inject/src/main/java/io/avaje/inject/event/Observes.java
+++ b/inject-events/src/main/java/io/avaje/inject/events/Observes.java
@@ -1,4 +1,4 @@
-package io.avaje.inject.event;
+package io.avaje.inject.events;
 
 import static java.lang.annotation.ElementType.PARAMETER;
 import static java.lang.annotation.RetentionPolicy.SOURCE;
diff --git a/inject/src/main/java/io/avaje/inject/event/ObservesAsync.java b/inject-events/src/main/java/io/avaje/inject/events/ObservesAsync.java
similarity index 98%
rename from inject/src/main/java/io/avaje/inject/event/ObservesAsync.java
rename to inject-events/src/main/java/io/avaje/inject/events/ObservesAsync.java
index d0f3c0bd..8f5f79d0 100644
--- a/inject/src/main/java/io/avaje/inject/event/ObservesAsync.java
+++ b/inject-events/src/main/java/io/avaje/inject/events/ObservesAsync.java
@@ -1,4 +1,4 @@
-package io.avaje.inject.event;
+package io.avaje.inject.events;
 
 import static java.lang.annotation.ElementType.PARAMETER;
 import static java.lang.annotation.RetentionPolicy.SOURCE;
diff --git a/inject-events/src/main/java/io/avaje/inject/events/package-info.java b/inject-events/src/main/java/io/avaje/inject/events/package-info.java
new file mode 100644
index 00000000..01a050d7
--- /dev/null
+++ b/inject-events/src/main/java/io/avaje/inject/events/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Event support.
+ */
+package io.avaje.inject.events;
diff --git a/inject/src/main/java/io/avaje/inject/DObserverManager.java b/inject-events/src/main/java/io/avaje/inject/events/spi/DObserverManager.java
similarity index 83%
rename from inject/src/main/java/io/avaje/inject/DObserverManager.java
rename to inject-events/src/main/java/io/avaje/inject/events/spi/DObserverManager.java
index f4a7a643..7c7d0e0e 100644
--- a/inject/src/main/java/io/avaje/inject/DObserverManager.java
+++ b/inject-events/src/main/java/io/avaje/inject/events/spi/DObserverManager.java
@@ -1,4 +1,4 @@
-package io.avaje.inject;
+package io.avaje.inject.events.spi;
 
 import java.lang.reflect.Type;
 import java.util.ArrayList;
@@ -6,8 +6,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import io.avaje.inject.event.Observer;
-import io.avaje.inject.event.ObserverManager;
+import io.avaje.inject.events.Observer;
+import io.avaje.inject.events.ObserverManager;
 
 final class DObserverManager implements ObserverManager {
 
diff --git a/inject-events/src/main/java/io/avaje/inject/events/spi/ObserverManagerPlugin.java b/inject-events/src/main/java/io/avaje/inject/events/spi/ObserverManagerPlugin.java
new file mode 100644
index 00000000..dd19a306
--- /dev/null
+++ b/inject-events/src/main/java/io/avaje/inject/events/spi/ObserverManagerPlugin.java
@@ -0,0 +1,20 @@
+package io.avaje.inject.events.spi;
+
+import io.avaje.inject.BeanScopeBuilder;
+import io.avaje.inject.spi.InjectPlugin;
+import io.avaje.spi.ServiceProvider;
+
+/** Plugin for avaje inject that provides a default ObserverManager instance. */
+@ServiceProvider
+public final class ObserverManagerPlugin implements InjectPlugin {
+
+  @Override
+  public Class<?>[] provides() {
+    return new Class<?>[] {DObserverManager.class};
+  }
+
+  @Override
+  public void apply(BeanScopeBuilder builder) {
+    builder.provideDefault(null, DObserverManager.class, DObserverManager::new);
+  }
+}
diff --git a/inject-events/src/main/java/module-info.java b/inject-events/src/main/java/module-info.java
new file mode 100644
index 00000000..9e0d0a19
--- /dev/null
+++ b/inject-events/src/main/java/module-info.java
@@ -0,0 +1,8 @@
+module io.avaje.inject.events {
+
+  exports io.avaje.inject.events;
+
+  requires transitive io.avaje.inject;
+  requires static io.avaje.spi;
+  provides io.avaje.inject.spi.InjectSPI with io.avaje.inject.events.spi.ObserverManagerPlugin;
+}
diff --git a/inject-generator/pom.xml b/inject-generator/pom.xml
index 53494112..89274bc7 100644
--- a/inject-generator/pom.xml
+++ b/inject-generator/pom.xml
@@ -6,14 +6,14 @@
   <parent>
     <groupId>io.avaje</groupId>
     <artifactId>avaje-inject-parent</artifactId>
-    <version>10.0-RC5</version>
+    <version>10.0-RC6</version>
   </parent>
 
   <artifactId>avaje-inject-generator</artifactId>
   <name>avaje inject generator</name>
   <description>annotation processor generating source code for avaje-inject dependency injection</description>
   <properties>
-    <avaje.prisms.version>1.23</avaje.prisms.version>
+    <avaje.prisms.version>1.24</avaje.prisms.version>
   </properties>
   <dependencies>
 
diff --git a/inject-generator/src/main/java/io/avaje/inject/generator/EventPublisherWriter.java b/inject-generator/src/main/java/io/avaje/inject/generator/EventPublisherWriter.java
index 94c68959..ec896074 100644
--- a/inject-generator/src/main/java/io/avaje/inject/generator/EventPublisherWriter.java
+++ b/inject-generator/src/main/java/io/avaje/inject/generator/EventPublisherWriter.java
@@ -117,8 +117,8 @@ final class EventPublisherWriter {
 
   String imports() {
     importTypes.add("io.avaje.inject.Component");
-    importTypes.add("io.avaje.inject.event.Event");
-    importTypes.add("io.avaje.inject.event.ObserverManager");
+    importTypes.add("io.avaje.inject.events.Event");
+    importTypes.add("io.avaje.inject.events.ObserverManager");
     importTypes.add("io.avaje.inject.spi.Generated");
     importTypes.add(Type.class.getCanonicalName());
     if (!qualifier.isBlank()) {
diff --git a/inject-generator/src/main/java/io/avaje/inject/generator/ExternalProvider.java b/inject-generator/src/main/java/io/avaje/inject/generator/ExternalProvider.java
index eef66d05..ea6aa85f 100644
--- a/inject-generator/src/main/java/io/avaje/inject/generator/ExternalProvider.java
+++ b/inject-generator/src/main/java/io/avaje/inject/generator/ExternalProvider.java
@@ -31,6 +31,7 @@ final class ExternalProvider {
   private static final ClassLoader CLASS_LOADER = ExternalProvider.class.getClassLoader();
   private static final boolean injectAvailable = moduleCP();
   private static final Map<String, List<String>> avajePlugins = Map.ofEntries(
+    entry("io.avaje.inject.events.spi.ObserverManagerPlugin", of("io.avaje.inject.events.ObserverManager")),
     entry("io.avaje.jsonb.inject.DefaultJsonbProvider", of("io.avaje.jsonb.Jsonb")),
     entry("io.avaje.http.inject.DefaultResolverProvider", of("io.avaje.http.api.context.RequestContextResolver")),
     entry("io.avaje.nima.provider.DefaultConfigProvider",
diff --git a/inject-generator/src/main/java/io/avaje/inject/generator/FieldReader.java b/inject-generator/src/main/java/io/avaje/inject/generator/FieldReader.java
index 591c58fd..17629e7e 100644
--- a/inject-generator/src/main/java/io/avaje/inject/generator/FieldReader.java
+++ b/inject-generator/src/main/java/io/avaje/inject/generator/FieldReader.java
@@ -29,7 +29,7 @@ final class FieldReader {
     if (nullable || element.asType().toString().startsWith("java.util.Optional<")) {
       ProcessingContext.addOptionalType(fieldType);
     }
-    if (type.fullWithoutAnnotations().startsWith("io.avaje.inject.event.Event")) {
+    if (type.fullWithoutAnnotations().startsWith("io.avaje.inject.events.Event")) {
       EventPublisherWriter.write(element);
     }
   }
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 832d0d71..d7ccedcd 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
@@ -498,7 +498,7 @@ final class MethodReader {
         ProcessingContext.addOptionalType(paramType);
       }
 
-      if (fullUType.fullWithoutAnnotations().startsWith("io.avaje.inject.event.Event")) {
+      if (fullUType.fullWithoutAnnotations().startsWith("io.avaje.inject.events.Event")) {
         EventPublisherWriter.write(param);
       }
     }
@@ -560,6 +560,8 @@ final class MethodReader {
     void addImports(ImportTypeMap importTypes) {
       if (isObserveEvent) {
         importTypes.add("java.util.function.Consumer");
+        importTypes.add("io.avaje.inject.events.Observer");
+        importTypes.add("io.avaje.inject.events.ObserverManager");
       }
       importTypes.addAll(fullUType.importTypes());
       Util.getNullableAnnotation(element).map(Object::toString).ifPresent(importTypes::add);
diff --git a/inject-generator/src/main/java/io/avaje/inject/generator/ObservesPrism.java b/inject-generator/src/main/java/io/avaje/inject/generator/ObservesPrism.java
index b748beb4..4b0ac339 100644
--- a/inject-generator/src/main/java/io/avaje/inject/generator/ObservesPrism.java
+++ b/inject-generator/src/main/java/io/avaje/inject/generator/ObservesPrism.java
@@ -4,8 +4,8 @@ import java.util.Optional;
 
 import javax.lang.model.element.Element;
 
-import io.avaje.inject.event.Observes;
-import io.avaje.inject.event.ObservesAsync;
+import io.avaje.inject.events.Observes;
+import io.avaje.inject.events.ObservesAsync;
 import io.avaje.prism.GeneratePrism;
 
 @GeneratePrism(
diff --git a/inject-generator/src/main/java/io/avaje/inject/generator/SimpleBeanWriter.java b/inject-generator/src/main/java/io/avaje/inject/generator/SimpleBeanWriter.java
index afd73afc..8fba70c9 100644
--- a/inject-generator/src/main/java/io/avaje/inject/generator/SimpleBeanWriter.java
+++ b/inject-generator/src/main/java/io/avaje/inject/generator/SimpleBeanWriter.java
@@ -10,7 +10,6 @@ import java.io.IOException;
 import java.io.Writer;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -263,18 +262,25 @@ final class SimpleBeanWriter {
       }
       final var observesPrism = ObservesPrism.getInstanceOn(observeEvent.element());
       writer
-        .eol()
-        .indent(indent)
-        .append(
-          "%s.<%s>registerObserver(%s, %s, %s, %s, \"%s\");",
-          builder,
-          shortWithoutAnnotations,
-          observeTypeString,
-          observesPrism.priority(),
-          observesPrism.async(),
-          methodReader.name(),
-          observeEvent.qualifier())
-        .eol();
+          .eol()
+          .indent(indent)
+          .append(builder)
+          .eol()
+          .indent(indent)
+          .append("    .get(ObserverManager.class)")
+          .eol()
+          .indent(indent)
+          .append("    .<%s>registerObserver(", shortWithoutAnnotations)
+          .eol()
+          .indent(indent)
+          .append(
+              "        %s, new Observer<>(%s, %s, %s, \"%s\"));",
+              observeTypeString,
+              observesPrism.priority(),
+              observesPrism.async(),
+              methodReader.name(),
+              observeEvent.qualifier())
+          .eol();
     }
   }
 
diff --git a/inject-generator/src/main/java/io/avaje/inject/generator/package-info.java b/inject-generator/src/main/java/io/avaje/inject/generator/package-info.java
index c9eac994..c7e02af2 100644
--- a/inject-generator/src/main/java/io/avaje/inject/generator/package-info.java
+++ b/inject-generator/src/main/java/io/avaje/inject/generator/package-info.java
@@ -32,7 +32,6 @@ package io.avaje.inject.generator;
 
 import io.avaje.inject.*;
 import io.avaje.inject.aop.*;
-import io.avaje.inject.event.*;
 import io.avaje.inject.spi.*;
 import io.avaje.prism.GeneratePrism;
 import jakarta.inject.Inject;
diff --git a/inject-generator/src/main/java/module-info.java b/inject-generator/src/main/java/module-info.java
index 5118d899..76013e98 100644
--- a/inject-generator/src/main/java/module-info.java
+++ b/inject-generator/src/main/java/module-info.java
@@ -2,6 +2,7 @@ module io.avaje.inject.generator {
 
   requires java.compiler;
   requires io.avaje.inject;
+  requires io.avaje.inject.events;
   requires static io.avaje.prism;
 
   uses io.avaje.inject.spi.InjectSPI;
diff --git a/inject-gradle-plugin/build.gradle b/inject-gradle-plugin/build.gradle
index c8c6e619..ac63b123 100644
--- a/inject-gradle-plugin/build.gradle
+++ b/inject-gradle-plugin/build.gradle
@@ -14,7 +14,7 @@ repositories {
 }
 
 dependencies {
-  implementation 'io.avaje:avaje-inject:10.0-RC5'
+  implementation 'io.avaje:avaje-inject:10.0-RC6'
   implementation gradleApi()
 
   testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
diff --git a/inject-maven-plugin/pom.xml b/inject-maven-plugin/pom.xml
index 41d9223c..0be26e54 100644
--- a/inject-maven-plugin/pom.xml
+++ b/inject-maven-plugin/pom.xml
@@ -4,13 +4,13 @@
   <parent>
     <groupId>org.avaje</groupId>
     <artifactId>java11-oss</artifactId>
-    <version>4.1</version>
+    <version>4.2</version>
   </parent>
 
   <groupId>io.avaje</groupId>
   <artifactId>avaje-inject-maven-plugin</artifactId>
   <packaging>maven-plugin</packaging>
-  <version>10.0-RC5</version>
+  <version>10.0-RC6</version>
 
   <dependencies>
     <dependency>
diff --git a/inject/pom.xml b/inject/pom.xml
index d888c2f7..f59bf564 100644
--- a/inject/pom.xml
+++ b/inject/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>io.avaje</groupId>
     <artifactId>avaje-inject-parent</artifactId>
-    <version>10.0-RC5</version>
+    <version>10.0-RC6</version>
   </parent>
 
   <artifactId>avaje-inject</artifactId>
@@ -40,7 +40,7 @@
     <dependency>
       <groupId>io.avaje</groupId>
       <artifactId>avaje-spi-service</artifactId>
-      <version>1.8</version>
+      <version>1.9</version>
       <optional>true</optional>
     </dependency>
 
@@ -50,6 +50,12 @@
       <version>5.12.0</version>
       <optional>true</optional>
     </dependency>
+    
+     <dependency>
+      <groupId>io.avaje</groupId>
+      <artifactId>avaje-inject-events</artifactId>
+      <version>${project.version}</version>
+    </dependency>
 
     <!-- test dependencies -->
 
diff --git a/inject/src/main/java/io/avaje/inject/DBeanScopeBuilder.java b/inject/src/main/java/io/avaje/inject/DBeanScopeBuilder.java
index b8aaacca..2f943d3a 100644
--- a/inject/src/main/java/io/avaje/inject/DBeanScopeBuilder.java
+++ b/inject/src/main/java/io/avaje/inject/DBeanScopeBuilder.java
@@ -15,7 +15,6 @@ import java.util.function.Consumer;
 import java.util.function.Supplier;
 
 import io.avaje.applog.AppLog;
-import io.avaje.inject.event.ObserverManager;
 import io.avaje.inject.spi.*;
 import io.avaje.lang.NonNullApi;
 import io.avaje.lang.Nullable;
@@ -241,7 +240,6 @@ final class DBeanScopeBuilder implements BeanScopeBuilder.ForTesting {
     final var start = System.currentTimeMillis();
     // load and apply plugins first
     initClassLoader();
-    provideDefault(ObserverManager.class, DObserverManager::new);
 
     var serviceLoader = new DServiceLoader(classLoader);
     if (propertyRequiresPlugin == null) {
diff --git a/inject/src/main/java/io/avaje/inject/event/package-info.java b/inject/src/main/java/io/avaje/inject/event/package-info.java
deleted file mode 100644
index b82e1ec0..00000000
--- a/inject/src/main/java/io/avaje/inject/event/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * Event support.
- */
-package io.avaje.inject.event;
diff --git a/inject/src/main/java/io/avaje/inject/spi/Builder.java b/inject/src/main/java/io/avaje/inject/spi/Builder.java
index 5fad9539..89b5dd3a 100644
--- a/inject/src/main/java/io/avaje/inject/spi/Builder.java
+++ b/inject/src/main/java/io/avaje/inject/spi/Builder.java
@@ -76,10 +76,6 @@ public interface Builder {
    */
   <T> void registerProvider(Provider<T> provider);
 
-  /**
-   * Register the observer into the context.
-   */
-  <T> void registerObserver(Type type, int priority, boolean async, Consumer<T> observer, String qualifier);
 
   /**
    * Register the bean instance into the context.
diff --git a/inject/src/main/java/io/avaje/inject/spi/DBuilder.java b/inject/src/main/java/io/avaje/inject/spi/DBuilder.java
index 40d22acc..e3930087 100644
--- a/inject/src/main/java/io/avaje/inject/spi/DBuilder.java
+++ b/inject/src/main/java/io/avaje/inject/spi/DBuilder.java
@@ -2,8 +2,6 @@ package io.avaje.inject.spi;
 
 import io.avaje.inject.BeanEntry;
 import io.avaje.inject.BeanScope;
-import io.avaje.inject.event.Observer;
-import io.avaje.inject.event.ObserverManager;
 import jakarta.inject.Provider;
 
 import java.lang.reflect.Type;
@@ -189,12 +187,6 @@ class DBuilder implements Builder {
     beanMap.register(provider);
   }
 
-  @Override
-  public <T> void registerObserver(Type type, int priority, boolean async, Consumer<T> observer, String qualifier) {
-    get(ObserverManager.class)
-        .registerObserver(type, new Observer<>(priority, async, observer, qualifier));
-  }
-
   @Override
   public final <T> void withBean(Class<T> type, T bean) {
     next(null, type);
diff --git a/inject/src/main/java/module-info.java b/inject/src/main/java/module-info.java
index b5179a2a..625b62c5 100644
--- a/inject/src/main/java/module-info.java
+++ b/inject/src/main/java/module-info.java
@@ -2,7 +2,6 @@ module io.avaje.inject {
 
   exports io.avaje.inject;
   exports io.avaje.inject.aop;
-  exports io.avaje.inject.event;
   exports io.avaje.inject.spi;
 
   requires transitive io.avaje.lang;
diff --git a/jakarta-to-javax.sh b/jakarta-to-javax.sh
index bdedcfce..84ab6fd6 100755
--- a/jakarta-to-javax.sh
+++ b/jakarta-to-javax.sh
@@ -4,6 +4,7 @@
 
 sed -i -E '0,/<version>[^<]*<\/version>/ s/<version>([^-]*)-?([^<]*)(<\/version>)/<version>\1-javax\2\3/' pom.xml
 sed -i -E '0,/<version>[^<]*<\/version>/ s/<version>([^-]*)-?([^<]*)(<\/version>)/<version>\1-javax\2\3/' inject/pom.xml
+sed -i -E '0,/<version>[^<]*<\/version>/ s/<version>([^-]*)-?([^<]*)(<\/version>)/<version>\1-javax\2\3/' inject-events/pom.xml
 sed -i -E '0,/<version>[^<]*<\/version>/ s/<version>([^-]*)-?([^<]*)(<\/version>)/<version>\1-javax\2\3/' inject-generator/pom.xml
 sed -i -E '0,/<version>[^<]*<\/version>/ s/<version>([^-]*)-?([^<]*)(<\/version>)/<version>\1-javax\2\3/' inject-test/pom.xml
 sed -i -E '0,/<version>[^<]*<\/version>/ s/<version>([^-]*)-?([^<]*)(<\/version>)/<version>\1-javax\2\3/' blackbox-aspect/pom.xml
diff --git a/javax-to-jakarta.sh b/javax-to-jakarta.sh
index 8fa6e78c..c0176051 100755
--- a/javax-to-jakarta.sh
+++ b/javax-to-jakarta.sh
@@ -4,6 +4,7 @@
 
 sed -i 's/\(<version>[^<]*\)-javax\([^<]*<\/version>\)/\1\2/' pom.xml
 sed -i 's/\(<version>[^<]*\)-javax\([^<]*<\/version>\)/\1\2/' inject/pom.xml
+sed -i 's/\(<version>[^<]*\)-javax\([^<]*<\/version>\)/\1\2/' inject-events/pom.xml
 sed -i 's/\(<version>[^<]*\)-javax\([^<]*<\/version>\)/\1\2/' inject-generator/pom.xml
 sed -i 's/\(<version>[^<]*\)-javax\([^<]*<\/version>\)/\1\2/' inject-test/pom.xml
 sed -i 's/\(<version>[^<]*\)-javax\([^<]*<\/version>\)/\1\2/' blackbox-aspect/pom.xml
diff --git a/pom.xml b/pom.xml
index abfc14ab..1541f7b1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>io.avaje</groupId>
   <artifactId>avaje-inject-parent</artifactId>
-  <version>10.0-RC5</version>
+  <version>10.0-RC6</version>
   <packaging>pom</packaging>
   <name>avaje inject parent</name>
   <description>parent pom for avaje inject library</description>
@@ -24,6 +24,7 @@
 
   <modules>
     <module>inject</module>
+    <module>inject-events</module>
     <module>inject-generator</module>
     <module>inject-test</module>
   </modules>


Test patch:
diff --git a/blackbox-test-inject/pom.xml b/blackbox-test-inject/pom.xml
index 70089341..7a2c3125 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>10.0-RC5</version>
+    <version>10.0-RC6</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
 
diff --git a/blackbox-test-inject/src/main/java/org/example/myapp/events/ExternalEventPublisher.java b/blackbox-test-inject/src/main/java/org/example/myapp/events/ExternalEventPublisher.java
index 5f9a7573..65460437 100644
--- a/blackbox-test-inject/src/main/java/org/example/myapp/events/ExternalEventPublisher.java
+++ b/blackbox-test-inject/src/main/java/org/example/myapp/events/ExternalEventPublisher.java
@@ -4,7 +4,7 @@ import org.example.external.aspect.MyExternalAspect;
 import org.other.one.SomeOptionalDep;
 
 import io.avaje.inject.Component;
-import io.avaje.inject.event.Event;
+import io.avaje.inject.events.Event;
 
 @Component
 public class ExternalEventPublisher {
diff --git a/blackbox-test-inject/src/main/java/org/example/myapp/events/ExternalObserver.java b/blackbox-test-inject/src/main/java/org/example/myapp/events/ExternalObserver.java
index 0b06a736..d880e2c5 100644
--- a/blackbox-test-inject/src/main/java/org/example/myapp/events/ExternalObserver.java
+++ b/blackbox-test-inject/src/main/java/org/example/myapp/events/ExternalObserver.java
@@ -2,7 +2,7 @@ package org.example.myapp.events;
 
 import org.other.one.SomeOptionalDep;
 
-import io.avaje.inject.event.Observes;
+import io.avaje.inject.events.Observes;
 import jakarta.inject.Singleton;
 
 @Singleton
diff --git a/inject/src/test/java/io/avaje/inject/events/TestEvent.java b/inject-events/src/test/java/io/avaje/inject/events/events/TestEvent.java
similarity index 52%
rename from inject/src/test/java/io/avaje/inject/events/TestEvent.java
rename to inject-events/src/test/java/io/avaje/inject/events/events/TestEvent.java
index 9c9b1d1b..d96fad59 100644
--- a/inject/src/test/java/io/avaje/inject/events/TestEvent.java
+++ b/inject-events/src/test/java/io/avaje/inject/events/events/TestEvent.java
@@ -1,7 +1,7 @@
-package io.avaje.inject.events;
+package io.avaje.inject.events.events;
 
-import io.avaje.inject.event.Event;
-import io.avaje.inject.event.ObserverManager;
+import io.avaje.inject.events.Event;
+import io.avaje.inject.events.ObserverManager;
 
 public class TestEvent extends Event<String> {
 
diff --git a/inject/src/test/java/io/avaje/inject/events/TestGenericEvent.java b/inject-events/src/test/java/io/avaje/inject/events/events/TestGenericEvent.java
similarity index 66%
rename from inject/src/test/java/io/avaje/inject/events/TestGenericEvent.java
rename to inject-events/src/test/java/io/avaje/inject/events/events/TestGenericEvent.java
index 53c11e95..49695e27 100644
--- a/inject/src/test/java/io/avaje/inject/events/TestGenericEvent.java
+++ b/inject-events/src/test/java/io/avaje/inject/events/events/TestGenericEvent.java
@@ -1,9 +1,9 @@
-package io.avaje.inject.events;
+package io.avaje.inject.events.events;
 
 import java.util.List;
 
-import io.avaje.inject.event.Event;
-import io.avaje.inject.event.ObserverManager;
+import io.avaje.inject.events.Event;
+import io.avaje.inject.events.ObserverManager;
 import io.avaje.inject.spi.GenericType;
 
 public class TestGenericEvent extends Event<List<String>> {
diff --git a/inject/src/test/java/io/avaje/inject/DObserverManagerTest.java b/inject-events/src/test/java/io/avaje/inject/events/spi/DObserverManagerTest.java
similarity index 94%
rename from inject/src/test/java/io/avaje/inject/DObserverManagerTest.java
rename to inject-events/src/test/java/io/avaje/inject/events/spi/DObserverManagerTest.java
index 2896edc8..6c878b1a 100644
--- a/inject/src/test/java/io/avaje/inject/DObserverManagerTest.java
+++ b/inject-events/src/test/java/io/avaje/inject/events/spi/DObserverManagerTest.java
@@ -1,4 +1,4 @@
-package io.avaje.inject;
+package io.avaje.inject.events.spi;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
@@ -11,10 +11,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.junit.jupiter.api.Test;
 
-import io.avaje.inject.event.Observer;
-import io.avaje.inject.event.ObserverManager;
-import io.avaje.inject.events.TestEvent;
-import io.avaje.inject.events.TestGenericEvent;
+import io.avaje.inject.events.Observer;
+import io.avaje.inject.events.ObserverManager;
+import io.avaje.inject.events.events.TestEvent;
+import io.avaje.inject.events.events.TestGenericEvent;
 import io.avaje.inject.spi.GenericType;
 
 class DObserverManagerTest {
diff --git a/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/EventSender.java b/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/EventSender.java
index a3fcd743..747f9d40 100644
--- a/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/EventSender.java
+++ b/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/EventSender.java
@@ -2,8 +2,7 @@ package io.avaje.inject.generator.models.valid.observes;
 
 import java.util.List;
 
-import io.avaje.inject.event.Event;
-import io.avaje.inject.spi.GenericType;
+import io.avaje.inject.events.Event;
 import io.avaje.inject.generator.models.valid.qualifier.TempQualifier;
 import io.avaje.inject.generator.models.valid.qualifier.TempQualifier.Scale;
 import jakarta.inject.Inject;
diff --git a/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestGenericObserver.java b/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestGenericObserver.java
index 7001a70b..aad9654a 100644
--- a/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestGenericObserver.java
+++ b/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestGenericObserver.java
@@ -2,7 +2,7 @@ package io.avaje.inject.generator.models.valid.observes;
 
 import java.util.List;
 
-import io.avaje.inject.event.Observes;
+import io.avaje.inject.events.Observes;
 import jakarta.inject.Singleton;
 
 @Singleton
diff --git a/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestObserver.java b/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestObserver.java
index d3f04595..a3448e2c 100644
--- a/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestObserver.java
+++ b/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestObserver.java
@@ -1,6 +1,6 @@
 package io.avaje.inject.generator.models.valid.observes;
 
-import io.avaje.inject.event.Observes;
+import io.avaje.inject.events.Observes;
 import jakarta.inject.Singleton;
 
 @Singleton
diff --git a/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestObserverInjection.java b/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestObserverInjection.java
index 6a80c405..3c3a18e3 100644
--- a/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestObserverInjection.java
+++ b/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestObserverInjection.java
@@ -1,6 +1,6 @@
 package io.avaje.inject.generator.models.valid.observes;
 
-import io.avaje.inject.event.ObservesAsync;
+import io.avaje.inject.events.ObservesAsync;
 import jakarta.inject.Singleton;
 
 @Singleton
diff --git a/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestQualifiedObserver.java b/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestQualifiedObserver.java
index d77160ff..bc177175 100644
--- a/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestQualifiedObserver.java
+++ b/inject-generator/src/test/java/io/avaje/inject/generator/models/valid/observes/TestQualifiedObserver.java
@@ -2,7 +2,7 @@ package io.avaje.inject.generator.models.valid.observes;
 
 import java.util.List;
 
-import io.avaje.inject.event.Observes;
+import io.avaje.inject.events.Observes;
 import jakarta.inject.Named;
 import jakarta.inject.Singleton;
 
diff --git a/inject-test/pom.xml b/inject-test/pom.xml
index bcc7feda..17d0f8c8 100644
--- a/inject-test/pom.xml
+++ b/inject-test/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>io.avaje</groupId>
     <artifactId>avaje-inject-parent</artifactId>
-    <version>10.0-RC5</version>
+    <version>10.0-RC6</version>
   </parent>
 
   <artifactId>avaje-inject-test</artifactId>
diff --git a/inject-test/src/main/java/module-info.java b/inject-test/src/main/java/module-info.java
index 078ce9b4..4500839e 100644
--- a/inject-test/src/main/java/module-info.java
+++ b/inject-test/src/main/java/module-info.java
@@ -8,6 +8,7 @@ module io.avaje.inject.test {
   requires static org.apiguardian.api; // needed for javadoc
   requires transitive org.mockito;
   requires transitive org.mockito.junit.jupiter;
+  requires static io.avaje.inject.events;
 //  requires transitive org.assertj.core;
 //  requires transitive net.bytebuddy;
   requires static java.net.http; // for testing only
diff --git a/inject-test/src/test/java/org/example/observes/EventSender.java b/inject-test/src/test/java/org/example/observes/EventSender.java
index 18b9be0a..78ab9975 100644
--- a/inject-test/src/test/java/org/example/observes/EventSender.java
+++ b/inject-test/src/test/java/org/example/observes/EventSender.java
@@ -1,7 +1,7 @@
 package org.example.observes;
 
 import io.avaje.inject.Component;
-import io.avaje.inject.event.Event;
+import io.avaje.inject.events.Event;
 import jakarta.inject.Inject;
 
 @Component
diff --git a/inject-test/src/test/java/org/example/observes/EventSender2.java b/inject-test/src/test/java/org/example/observes/EventSender2.java
index 64bc8243..8d1c3cd2 100644
--- a/inject-test/src/test/java/org/example/observes/EventSender2.java
+++ b/inject-test/src/test/java/org/example/observes/EventSender2.java
@@ -1,7 +1,7 @@
 package org.example.observes;
 
 import io.avaje.inject.Component;
-import io.avaje.inject.event.Event;
+import io.avaje.inject.events.Event;
 import jakarta.inject.Inject;
 
 @Component
diff --git a/inject-test/src/test/java/org/example/observes/MyObserver.java b/inject-test/src/test/java/org/example/observes/MyObserver.java
index 5cf5f605..50cd09eb 100644
--- a/inject-test/src/test/java/org/example/observes/MyObserver.java
+++ b/inject-test/src/test/java/org/example/observes/MyObserver.java
@@ -1,6 +1,6 @@
 package org.example.observes;
 
-import io.avaje.inject.event.Observes;
+import io.avaje.inject.events.Observes;
 import jakarta.inject.Singleton;
 
 @Singleton
diff --git a/inject-test/src/test/java/org/example/observes/MyObserver2.java b/inject-test/src/test/java/org/example/observes/MyObserver2.java
index 67bf5376..66f902f4 100644
--- a/inject-test/src/test/java/org/example/observes/MyObserver2.java
+++ b/inject-test/src/test/java/org/example/observes/MyObserver2.java
@@ -1,6 +1,6 @@
 package org.example.observes;
 
-import io.avaje.inject.event.Observes;
+import io.avaje.inject.events.Observes;
 import jakarta.inject.Singleton;
 
 @Singleton
diff --git a/inject-test/src/test/java/org/example/observes/MyObserverInjected.java b/inject-test/src/test/java/org/example/observes/MyObserverInjected.java
index 599b0dcc..a1a4c96c 100644
--- a/inject-test/src/test/java/org/example/observes/MyObserverInjected.java
+++ b/inject-test/src/test/java/org/example/observes/MyObserverInjected.java
@@ -1,6 +1,6 @@
 package org.example.observes;
 
-import io.avaje.inject.event.Observes;
+import io.avaje.inject.events.Observes;
 import jakarta.inject.Singleton;
 
 @Singleton
diff --git a/inject-test/src/test/java/org/example/observes/MyQualifiedObserver.java b/inject-test/src/test/java/org/example/observes/MyQualifiedObserver.java
index afe05767..4e73aca6 100644
--- a/inject-test/src/test/java/org/example/observes/MyQualifiedObserver.java
+++ b/inject-test/src/test/java/org/example/observes/MyQualifiedObserver.java
@@ -1,6 +1,6 @@
 package org.example.observes;
 
-import io.avaje.inject.event.Observes;
+import io.avaje.inject.events.Observes;
 import jakarta.inject.Named;
 import jakarta.inject.Singleton;
 
diff --git a/inject-test/src/test/java/org/example/observes/MyStrQualifiedObserver.java b/inject-test/src/test/java/org/example/observes/MyStrQualifiedObserver.java
index 25cda79f..e493a7cf 100644
--- a/inject-test/src/test/java/org/example/observes/MyStrQualifiedObserver.java
+++ b/inject-test/src/test/java/org/example/observes/MyStrQualifiedObserver.java
@@ -1,6 +1,6 @@
 package org.example.observes;
 
-import io.avaje.inject.event.Observes;
+import io.avaje.inject.events.Observes;
 import jakarta.inject.Singleton;
 
 @Singleton
diff --git a/inject-test/src/test/java/org/example/observes/TestEventMessaging.java b/inject-test/src/test/java/org/example/observes/TestEventMessaging.java
index cc6167ed..d8603a01 100644
--- a/inject-test/src/test/java/org/example/observes/TestEventMessaging.java
+++ b/inject-test/src/test/java/org/example/observes/TestEventMessaging.java
@@ -2,13 +2,13 @@ package org.example.observes;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import jakarta.inject.Named;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-import io.avaje.inject.event.Event;
+import io.avaje.inject.events.Event;
 import io.avaje.inject.test.InjectTest;
 import jakarta.inject.Inject;
+import jakarta.inject.Named;
 
 @InjectTest
 class TestEventMessaging {