Overview

General

Configuration

Servers

Integrations

Community

Feeds


Site
News
   



Annotations, Defaults and XML
[ edit ]

Annotation xml element(s) default value
@Stateless
  • <session>
  • <ejb-class>
  • <session-type>Stateless</session-type>
 
  • name
<ejb-name> The simple name of the bean class. For org.acme.superfun.WidgetBean the ejb-name will be WidgetBean
  • description
<description>  
  • mappedName
<mapped-name>  
@Stateful
  • <session>
  • <ejb-class>
  • <session-type>Stateful</session-type>
 
  • name
<ejb-name> The simple name of the bean class. For org.acme.superfun.WidgetBean the ejb-name will be WidgetBean
  • description
<description>  
  • mappedName
<mapped-name>  
@MessageDriven
  • <message-driven>
  • <ejb-class>
  • <session-type>Stateful</session-type>
 
  • name
<ejb-name> The simple name of the bean class. For org.acme.superfun.WidgetBean the ejb-name will be WidgetBean
  • description
<description>  
  • mappedName
<mapped-name>  
  • messageListenerInterface
<messaging-type> The interface the bean class implements. When relying upon the default is illegal for the bean to implement more than one interface
  • activationConfig[]
<activation-config>  
@ActivationConfigProperty <activation-config-property>  
  • propertyName
<activation-config-property-name>  
  • propertyValue
<activation-config-property-value>  
@RemoteHome
  • <home>
  • <remote>
The home is inspected to determine the value of <remote>
@LocalHome
  • <local-home>
  • <local>
The local-home is inspected to determine the value of <local>
@TransactionManagement <transaction-type> TransactionManagementType.CONTAINER
@TransactionAttribute
  • <container-transaction>
  • <transaction-attribute>
All method default to TransactionAttributeType.REQUIRED
@RolesAllowed
  • <method-permission>
  • <role-name>
 
@PermitAll
  • <method-permission>
  • <unchecked>
All methods default to unchecked
@DenyAll <exclude-list>  
@RunAs
  • <security-identity>
  • <run-as>
  • <role-name>
 
@DeclareRoles <security-role-ref>  
@Interceptors
  • <interceptor>
  • <interceptor-binding>
  • <interceptor-class>
 
@ExcludeDefaultInterceptors
  • <interceptor-binding>
  • <exclude-default-interceptors>
 
@ExcludeClassInterceptors
  • <interceptor-binding>
  • <exclude-class-interceptors>
 
@AroundInvoke <around-invoke>  
@PostConstruct <post-construct>  
@PreDestroy <pre-destroy>  
@PrePassivate <pre-passivate>  
@PostActivate <post-activate>  
@Init <init-method>  
@Remove <remove-method>  
  • retainIfException
<retain-if-exception> false
@Timeout <timeout-method>  
@ApplicationException
  • <application-exception>
  • <exception-class>
 
  • rollback
<rollback> false
@EJB
  • <ejb-ref>
  • <ejb-local-ref>
  • <injection-target>
 
  • name
  • <ejb-ref-name>
  • on class: illegal to leave undefined
  • on field: {className}/{fieldName} as in org.superbiz.Widget/myEjb
  • on setter: {className}/{propertyName} as in setMyEjb() defaults to org.superbiz.Widget/myEjb
  • beanInterface
  • <home>
  • <local-home>
  • <remote>
  • <local>
  • on class: illegal to leave undefined
  • on field: the data type of the field
  • on setter: the data type of the first method param
  • beanName
<ejb-link>  
  • description
<description>  
  • mappedName
<mapped-name>  

@EJB used on a class replaces <ejb-ref> and <ejb-local-ref>. @EJB used on a field or setter method (private or public) request injection of that EJB as well. When @EJB is used on a class the "beanInterface" attribute is required. When used on a field or setter method, the "beanInterface" attribute defaults to the type of the field or setter method.

@Resource used on a class replaces <env-entry>, <resource-ref>, <resource-env-ref>. @Resource used on a field or method (private or public) requests injection of that resource. When @Resource is used on a class, the "type" attribute is required. When used on a field or method, the "type" attribute defaults to the type of the field or setter method.

There are more annotations obviously, but these are fairly simple and get rid of a ton of xml.

         
     
     
     
 


Apache OpenEJB is an project of The Apache Software Foundation (ASF)
 
Powered by Atlassian Confluence.