Specify the reference to EJB business interface or home interface. You can specify in a class, method, and field. When specified in a method or field, the annotation becomes a target for Dependency Injection. However, the method must be set method.
The following table lists the elements of @EJB:
Element name | Functionality |
---|---|
name | Specify the name of resource reference. The specified name is used as a JNDI name. You can omit the element description if the annotation is specified in a method or field. |
beanInterface | Specify the business interface class or home interface class. You can omit the element description if the annotation is specified in a method or field. |
beanName | Specify the class name without the EJB package to be referenced. However, when the name element is specified in the annotation (@Stateless, @Stateful) that defines the EJB class to be referenced, specify the name element. Further, in the case of an EJB that supports the definition in DD, specify the value of DD <ejb--name>tag. |
mappedName | You can specify the element, but you cannot run elements on Cosminexus because Cosminexus does not support elements. |
lookup | Specify the Portable Global JNDI or the optional name of EJB that is referenced. However, if the beanName attribute or mappedName attributes are specified, settings of beanName attributes or mappedName attributes are preferred. |
description | Specify the description of the EJB to be referenced. |
The details of each element are as follows: