Oracle
1Z0-895 · Question #90
A developer writes a stateful session bean called FooBean. Which code can be inserted before Line 11 of the FooBean class to define a TYPE-level environment dependency on a JMS Topic? 11. public…
The correct answer is D. @Resource(name="topicRef", type=Topic.class). @Resource can decorate a class, a field or a method at runtime/init through injection. (name, type, authenticationType, shareable, mappedName, description) Type- level env dependency on a Topic - @Resource(name="topicRef", type=Topic.class)
JMS and Message-Driven Beans
Question
A developer writes a stateful session bean called FooBean. Which code can be inserted before Line 11 of the FooBean class to define a TYPE-level environment dependency on a JMS Topic? 11. public class FooBean { 12. 13. public void foo() () 14. 15. }
Options
- A@Resource (type=Topic.class)
- B@Resource (name="topicRef")
- C@Resource private Topic topic
- D@Resource(name="topicRef", type=Topic.class)
How the community answered
(30 responses)- A17% (5)
- B3% (1)
- C7% (2)
- D73% (22)
Explanation
@Resource can decorate a class, a field or a method at runtime/init through injection. (name, type, authenticationType, shareable, mappedName, description) Type- level env dependency on a Topic - @Resource(name="topicRef", type=Topic.class)
Topics
#@Resource#JMS Topic#type-level injection#class-level annotation
Community Discussion
No community discussion yet for this question.