Version 31

    This article will guide developers/users of JBoss AS as to what annotations and xml files are available at their disposal for their applications. The same is applicable to JBoss EAP 5.x


    See also:  Java EE 5 and 6 XSD's  - J2EE 1.4 XSD's  - older DTD's



    Java EE Specification Annotations


    Enterprise Java Beans 3.1

    Component Annotations
    @MessageDrivenComponent-defining annotation for a message driven bean.
    @SingletonComponent-defining annotation for a singleton session bean.
    @StatefulComponent-defining annotation for a stateful session bean.
    @StatelessComponent-defining annotation for a stateful session bean.
    Bean Annotations
    @AccessTimeoutSpecifies the amount of time in a given time unit that a concurrent   access attempt should block before timing out.
    @ActivationConfigPropertyDesignate a configuration property on a message driven bean.
    @AfterBeginDesignate a stateful session bean method to receive the AfterBegin  Session Synchronization callback.
    @AfterCompletionDesignate a stateful session bean method to receive the AfterCompletion  Session Synchronization callback.
    @ApplicationExceptionApplied to an exception to denote that it is an application exception  and should be reported to the client directly(i.e., unwrapped).
    @AsynchronousUsed to mark a method as an asynchronous method or to designate all  business   methods of a class or interface as asynchronous.
    @BeforeCompletionDesignate a stateful session bean method to receive the BeforeCompletion  Session Synchronization callback.
    @ConcurrencyManagementDeclares a Singleton or Stateful session bean's concurrency management  type.
    @DependsOnUsed to express an initialization dependency between Singleton  components.
    @InitDesignates a method of a session bean that corresponds to the   create method of an adapted Home interface or an adapted Local   Home interface.
    @LocalWhen used on the bean class, declares the local business interface(s)   for a session bean.
    @LocalBeanDesignates that a session bean exposes a no-interface view.
    @LocalHomeDeclares the Local Home or adapted Local Home interface  for a session bean.
    @LockDeclares a concurrency lock for a singleton method.
    @PostActivateDesignates a method to receive a callback after a stateful session  bean has been activated.
    @PrePassivateDesignates a method to receive a callback before a stateful session  bean is passivated.
    @RemoteDeclares the remote business interface(s) for a session bean.
    @RemoteHomeDeclares the Remote Home interface or adapted Remote Home interface  for a session bean.
    @RemoveApplied to a business method of a stateful session bean class.
    @ScheduleSchedule a timer for automatic creation with a timeout schedule based   on a cron-like time expression.
    @SchedulesSchedules multiple timers that use the same method as the timeout  callback method.
    @StartupMark a Singleton for eager loading during application initialization.
    @StatefulTimeoutSpecifies the amount of time a stateful session bean can  be idle ( not receive any client invocations ) before it  is eligible for removal by the container.
    @TimeoutDesignates a method on a stateless session bean class or  message driven bean class that should receive EJB timer expirations  for that bean.
    @TransactionAttributeWhen applied at the TYPE-level, designates the default transaction  attribute  for all business methods of the session or message driven bean.
    @TransactionManagementDeclares whether a session bean or message driven bean has  container managed transactions or bean managed transactions.
    Resource Annotations

    The following annotations can be used in any JSR 250 compliant component to inject a reference to an EJB.

    @EJBIndicates a dependency on the local, no-interface, or remote view of an  Enterprise  Java Bean.
    @EJBsDeclares multiple TYPE-level @EJB annotations.
    JBoss Extension Annotations
    @ClusteredIndicates an EJB3 Session bean should have clustering behavior

    TODO: these need to be removed from the EJB 3 section











    Java EE Compliant Annotations



    WebServices Service









    JSR 181 Annotations


    JSR 224 Annotations

    JBoss Specific Annotations

    EJB3 Service




    Clustering Service

    @ClusteredIndicates an EJB3 Session bean should have clustering behavior



    POJO Cache project annotations that indicate how POJO Cache should treat objects placed in the cache

    WebServices Service







    JBWS-Native stack specific annotations



    JBWS-Native WS-Policy annotations

    Microcontainer Service






    Weld integration

    AOP Service

    @AspectJBoss AOP defined annotations;



    Profile Service

    jboss-managed annotations
    jboss-metatype annotations



    Seam Service


    XML Files

    Java EE Specification Deployment Descriptors


    web.xmlWeb Application
    ejb-jar.xmlEJB Application
    application.xmlEnterprise Archive
    ra.xmlResource Adapter (RA)
    webservices.xmlJavaEE 1.4 Web Services


    JBoss Specific Deployment Descriptors


    jboss-app.xmlEnterprise Archive (EAR)
    jboss-web.xmlWeb Application
    jboss.xmlEJB Application
    jboss-ra.xmlResource Adapter (RA)
    jboss-service.xmlService Archive (SAR) - JBoss Archive
    xxx-jboss-beans.xmlMC Beans
    xxx-aop.xmlResolves pointcut and advice bindings for JBoss AOP


    JBoss Server Configuration Deployment Descriptors (For System Administrators)


    bootstrap.xmlconfThe list of URLs for mc beans to load during bootstrap.
    logging.xmlconf/bootstrapConfigures the Logging Subsystem
    aop.xmlconf/bootstrapConfigures the AOP Subsystem
    profile.xmlconf/bootstrapConfigures profile service (where deployers dir is, where deploy dir is, what files are watched for changes, etc)
    deployers.xmlconf/bootstrapDeployers' configuration (file extensions, patterns of DDs)


    WebService Descriptors





    JBossWS-Native WS-Security configuration (server and client sides)



    JBossWS-Native default setup of standard configurations (server and client sides), see @EndpointConfig usage
    jaxb-intros.xmlThe JAXBIntroductions descriptor




    Mapping between annotations and XML descriptor elements

    Kudos to .

    TODO: Merge to the tables above.

    TODO: Add JBoss - specific annotations and elements (jboss-*.xml)

    See also:


    Annotation Type Annotation Element Corresponding Descriptor Element
    @StatelessEJB type<session-type>Stateless
    @StatefulEJB type<session-type>Stateful
    @MessageDrivenEJB typemessage-driven
    @RemoteInterface typeremote
    @LocalInterface typelocal
    @Transaction-ManagementTransaction management type at bean leveltransaction-type
    @Transaction-AttributeTransaction settings methodcontainer-transaction trans-attribute
    @InterceptorsInterceptorsinterceptor-binding interceptor-class
    @AroundInvokeCustom interceptoraround-invoke
    @PreConstructLifecycle methodpre-construct
    @PostDestroyLifecycle methodpost-destroy
    @PostActivateLifecycle methodpost-activate
    @PrePassivateLifecycle methodpre-passivate
    @DeclareRolesSecurity settingsecurity-role
    @RolesAllowedSecurity settingmethod-permission
    @PermitAllSecurity settingunchecked
    @DenyAllSecurity settingexclude-list
    @RunAsSecurity settingsecurity-identity run-as
    @ResourceResource references
    (DataSource, JMS, Environment, mail, etc.)
    env-  ref
    Resource injectionSetter/field injectioninjection-target
    @EJBEJB referencesejb-ref
    @Persistence-ContextPersistence context referencepersistence-context-ref
    @PersistenceUnitPersistence unit referencepersistence-unit-ref