Which two annotations can be applied at the class, method, and field levels? (Choose two.)
Correct Answer: A,C
Explanation/Reference:
A: javax.ejb.EJB
Description
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
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