问题
I'd like to kind of pass-through a qualifier annotation using CDI. With that I mean that I'd want to add a qualifier to an injection point with that qualifier not being applied directly for the "first-level" injection target (because there is only one implementation for this) but a field within ("2nd level") the injected EJB. Is this possible with CDI? Does it maybe already work out-of-the-box?
It should look similar to:
@Stateless
public class MyFirstLevelEJB {
@Inject
//this guy has different Implementations with qualifiers, I want to use the qualifier here
private CDIBean2ndLevel myCDIBean;
}
2nd EJB:
@Stateless
public class My2ndLevelEJB {
@Inject
@AlternativeImplementation //this is the qualifier which I want to apply for CDIBean2ndLevel
MyFirstLevelEJB anInjectedEBJ;
}
Any help is greatly appreciated
来源:https://stackoverflow.com/questions/18013305/cdi-pass-through-qualifier-from-one-injection-point-to-the-other