Q1) It is mentioned in the JavEE 7 tutorial that CDI injections can happen only in container manager objects such as servlets, EJB's and managed bean. Does it mean that I cannot do CDI injection
in a JAX-RS
?
Q2) I remember reading in some blog (dont know exactly which one) that with Java EE 7 any POJO objects can be injected anywhere within the container, since the container will "look" for them and initialize. Is that true?
Q3)
To inject an EJB into another bean, one would do
public class MainBean {
@EJB
UserDao userDao;
}
If I have the following POJO's objects
@ThirteenDigits
public class Thirteendigitgenerator implements NumberGenerator { ...}
@FourDigits
public class FourDigitsgenerator implements NumberGenerator { ... }
I ignored the Qualifiers for @ThirteenDigits
and @FourDigits
here.
If I want to inject above ThirteenDigit POJO
into a bean,
I would do
@Inject @ThirteenDigits
NumberGenerator numbergenerator;
I am wondering if it is possible to do the following:
@ThirteenDigits
NumberGenerator numbergenerator;