]
Brian Stansberry updated WFLY-7914:
-----------------------------------
Component/s: EJB
injection of sub-sub-EJB fails with proxy
-----------------------------------------
Key: WFLY-7914
URL:
https://issues.jboss.org/browse/WFLY-7914
Project: WildFly
Issue Type: Bug
Components: CDI / Weld, EJB
Affects Versions: 10.1.0.Final
Environment: WildFly 10.1.0.Final
wildfly-arquillian-2.0.2.Final
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
Reporter: Tom Eicher
Assignee: Matej Novotny
Priority: Major
When a hierarchy of EJBs is looked up via {{Inject Instance}} for an interface that the
toplevel ejb implements, lower-hierarchy EJBs (below an {{abstract}} class) are not found
unless they (redundantly) reimplement the interface, when Weld is using view proxies.
In more Detail:
{code}
public interface A extends Serializable {}
...
@Stateless
public class A1 implements A {
public A1() {
}
}
...
public interface B extends A {}
...
@Stateless
public class B1 implements B {
public B1() {
}
}
...
public abstract class C implements A { }
...
@Stateless
public class C1 extends C {
public C1() {
}
}
...
@Stateless
public class C2 extends C implements A {
public C2() {
}
}
...
public class WeldProcessortInjectionProblemTest {
@Inject @Any Instance<A> testinstances;
@Test
public void testSubclassInjection() {
boolean foundC1=false, foundC2=false;
for (A a : testinstances) {
System.out.println(a);
}
}
}
...
Proxy for view class: com.ehtwo.core.util.A of EJB: C2
Proxy for view class: com.ehtwo.core.util.A of EJB: A1
Proxy for view class: com.ehtwo.core.util.B of EJB: B1
{code}
so, C1 is _not found/injected_ but C2 _is found/injected_, just because C2 re-implements
A, which is redundant because it's at the top of the class hierarchy anyway.
this only happens when "proxy for view" are being applied. (in my case because
the EJBs are in a JAR and the Test in a WAR inside an EAR). When running inside one
module, and no weld proxies are used, all classes including C1 are injected correctly.
please move/copy issue to Wildfly-Core or Weld or as you see fit.