I have a @Stateless bean in an EJB module
@Stateless
public class Foo {
@Inject Bar bar;
public void helloFromBar() { return bar.hello(); }
}
I have a @Named bean in the same EJB module
@Named @ApplicationScoped
public class Bar {
public String hello () { return "hello"; }
}
Bar#hello is called from a CDI bean in a web module.
@Named @ViewScoped
public class ViewBean {
@EJB Foo foo;
public String callFoo() { return foo.helloFromBar(); }
}
For some reason Bar is not injected into Foo - it is always a null reference. I would expect that this would work.
META-INF/beans.xml? - Brett Kail@Injectfields. I believe the major advantage is the ability to usefinalfields. - Brett Kail