Which two annotations can be applied at the class, method, and field levels?

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

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

A.
@EJB

B.
@Init

C.
@Resource

D.
@RolesAllowed

E.
@PostActivate

Explanation:
A:javax.ejb.EJB
Description
Target: Class, Method, Field
Specifies a dependency or reference to an EJB business or home interface.
You annotate a beans instance variable with the @EJB annotation to specify a dependence on
another EJB.
C:javax.annotation.Resource
Description
Target: Class, Method, Field
Specifies a dependence on an external resource, such as a JDBC data source or a JMS
destination or connection factory.

Incorrect:
B:javax.ejb.Init
Description
Target: Method
D:javax.annotation.security.RolesAllowed
Description
Target: Class, Method
Specifies the list of security roles that are allowed to access methods in the EJB.
E:javax.ejb.PostActivate
Description
Target: Method
Specifies the lifecycle callback method that signals that the EJB container has just reactivated the
bean instance.
Reference:EJB 3.0 Metadata Annotations Reference



Leave a Reply 0

Your email address will not be published. Required fields are marked *