diff --git a/testenrichers/cdi-jakarta/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java b/testenrichers/cdi-jakarta/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java index 243eb65d3..f1342c197 100644 --- a/testenrichers/cdi-jakarta/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java +++ b/testenrichers/cdi-jakarta/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java @@ -121,8 +121,9 @@ protected void injectClass(Object testCase) { @SuppressWarnings("unchecked") protected void injectNonContextualInstance(BeanManager manager, Object instance) { CreationalContext creationalContext = getCreationalContext(); - InjectionTarget injectionTarget = (InjectionTarget) manager.createInjectionTarget(manager - .createAnnotatedType(instance.getClass())); + InjectionTarget injectionTarget = (InjectionTarget) manager + .getInjectionTargetFactory(manager.createAnnotatedType(instance.getClass())) + .createInjectionTarget(null); injectionTarget.inject(instance, creationalContext); } } diff --git a/testenrichers/cdi/pom.xml b/testenrichers/cdi/pom.xml index 5fb93dfe9..ecf496be3 100644 --- a/testenrichers/cdi/pom.xml +++ b/testenrichers/cdi/pom.xml @@ -23,7 +23,7 @@ - 1.1.34.Final + 2.4.3.Final 2.2 1.7.30 @@ -48,7 +48,7 @@ javax.enterprise cdi-api - 1.0 + 1.2 provided diff --git a/testenrichers/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java b/testenrichers/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java index f93c418ae..9adc47d49 100644 --- a/testenrichers/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java +++ b/testenrichers/cdi/src/main/java/org/jboss/arquillian/testenricher/cdi/CDIInjectionEnricher.java @@ -121,8 +121,9 @@ protected void injectClass(Object testCase) { @SuppressWarnings("unchecked") protected void injectNonContextualInstance(BeanManager manager, Object instance) { CreationalContext creationalContext = getCreationalContext(); - InjectionTarget injectionTarget = (InjectionTarget) manager.createInjectionTarget(manager - .createAnnotatedType(instance.getClass())); + InjectionTarget injectionTarget = (InjectionTarget) manager + .getInjectionTargetFactory(manager.createAnnotatedType(instance.getClass())) + .createInjectionTarget(null); injectionTarget.inject(instance, creationalContext); } }