Exam 1z0-900 All QuestionsBrowse all questions from this exam
Question 32

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?

    Correct Answer: A

    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.

Discussion
kozionovOption: A

A because alternatives is on

peteVln

You can see a reference here: https://docs.oracle.com/javaee/6/tutorial/doc/gjsdf.html

orjavaOption: A

Answer A