nerdexam
Oracle

1Z0-895 · Question #76

Which two annotations can be applied at the class, method, and field levels? (Choose two.)

The correct answer is A. @EJB C. @Resource. Target: Class, Method, Field Specifies a dependency or reference to an EJB business or home interface. You annotate a bean's instance variable with the @EJB annotation to specify a dependence on another EJB. C:javax.annotation.Resource Target: Class, Method, Field Specifies a…

Session Beans

Question

Which two annotations can be applied at the class, method, and field levels? (Choose two.)

Options

  • A@EJB
  • B@Init
  • C@Resource
  • D@RolesAllowed
  • E@PostActivate

How the community answered

(28 responses)
  • A
    79% (22)
  • B
    4% (1)
  • D
    4% (1)
  • E
    14% (4)

Explanation

Target: Class, Method, Field Specifies a dependency or reference to an EJB business or home interface. You annotate a bean's instance variable with the @EJB annotation to specify a dependence on another EJB. C:javax.annotation.Resource Target: Class, Method, Field Specifies a dependence on an external resource, such as a JDBC data source or a JMS destination or connection factory. B:javax.ejb.Init D:javax.annotation.security.RolesAllowed Target: Class, Method Specifies the list of security roles that are allowed to access methods in E:javax.ejb.PostActivate Specifies the lifecycle callback method that signals that the EJB container has just reactivated the EJB 3.0 Metadata Annotations Reference

Topics

#@EJB#@Resource#injection annotations#annotation targets

Community Discussion

No community discussion yet for this question.

Full 1Z0-895 Practice