-
1. Re: SPI (JDK ServiceLoader) vs @EJB injection
banzeletti Aug 23, 2012 11:34 AM (in response to justkeys)According to my understanding of the EJB specification it has never been intended to support different implementations for the same interfaces. EJB only requires that there is an implementation, it does not specifiy the behaviour of the container in the case there are more than one implementations. So EJB is probably not the proper means to solve this kind of problem. CDI, however, introduces the notion of "Alternatives", which may come closer to your need (or, if you have the required knowledge at programming time, you may use CDI @Qualifiers as well). As far as I understand, EJB Interfaces were necessary in order to provide the stubs and proxies for remote clients (as far as I guess in order to use something calld "dynamic proxy" or deploy-time code generation). If you want to "look up" available implementations at runtime, EJB simply won't help (as far as I understand).