Given the code sample:
And:
And:
And the next fragment from beans.xml:
And this injection point:
@Inject GenericMessenger messageHandler;
Which type would be injected at run time and referenced by the messageHandler variable?
Given the code sample:
And:
And:
And the next fragment from beans.xml:
And this injection point:
@Inject GenericMessenger messageHandler;
Which type would be injected at run time and referenced by the messageHandler variable?
In the provided code example, the @Alternative annotation indicates that the SmsHandler is to be considered as an alternative implementation of the GenericMessenger interface. In addition, the beans.xml file specifies that the SmsHandler class should be the chosen alternative. Consequently, when GenericMessenger is injected, SmsHandler will be the implementation that is resolved at runtime due to the combination of @Alternative and the beans.xml configuration.
A because alternatives is on
You can see a reference here: https://docs.oracle.com/javaee/6/tutorial/doc/gjsdf.html
Answer A