I am studying the Dependency Injection
of EJB
without using CDI
and two questions have come up. I would be grateful to anyone could answer the following:
1) Is it possible to inject Session Beans (Stateful
ot Stateless
) with @EJB
annotation within Message Driven Beans
?
2) If one lets two Session Beans implement the same interface, can one inject them with @EJB
annotation specifying only the interface name? How can one make the Container
aware of the specific Bean class which is to be injected? For example:
@Remote
public interface RemoteInterface{}
@Stateless
public class BeanA implements RemoteInterfaceA{}
@Stateless
public class BeanB implements RemoteInterfaceA{}
@Stateful
public class StatefulBean{
@EJB
RemoteInterface
}
How can one specify which Bean is to be injected without using CDI
and Qualifiers?