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:

    http://www.jboss.org/j2ee/schema/

    http://www.jboss.org/j2ee/dtd/

    http://java.sun.com/xml/ns/javaee/  Java EE 5 and 6 XSD's

    http://java.sun.com/xml/ns/j2ee/  - J2EE 1.4 XSD's

    http://java.sun.com/dtd/  - older DTD's

     

    Annotations

    Java EE Specification Annotations

     

    Enterprise Java Beans 3.1

    Component Annotations
    AnnotationComments
    @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
    AnnotationComments
    @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.

    Annotation
    Comments
    @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
    AnnotationComments
    @ClusteredIndicates an EJB3 Session bean should have clustering behavior
    ToDoToDo

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

    AnnotationComments

    @Stateless
    @Statefull
    @Init
    @Remove
    @MessageDriven
    @Entity
    @Remote
    @Local
    @BusinessMethod

    @TransactionManagement
    @TransactionAttribute

    @MethodPermissions
    @SecurityRoles
    @Unchecked
    @Exclude
    @RunAs
    @SecurityRoles

    @CallBackListener
    @PostConstruct
    @PreDestroy
    @PostActivate
    @PrePassivate
    @EntityListener
    @PrePersist
    @PostPersist
    @PreRemove
    @PostRemove
    @PreUpdate
    @PostLoad

    @Resource
    @Resources
    @EJB
    @EJBs
    @Home

    @Interceptor
    @Interceptors
    @AroundInvoke
    @RemoteHome
    @LocalHome
    @FlushMode
    @NamedQuery
    @NamedQuerys 
    @SqlResultSetMapping
    @EntityResult
    @FieldResult
    @ColumnResult 
    @Table
    @SecondaryTable
    @SecondaryTables
    @UniqueConstraint
    @Column
    @JoinColumn
    @JoinColumns
    @EmbeddedId
    @AttributeOverride
    @IdClass
    @Transient
    @Version
    @Lob

    @ManyToOne

    @OneToOne
    @OneToMany

    @AssociationTable
    @ManyToMany
    @Inhertance
    @InheritanceJoinColumn
    @InheritanceJoinColumn
    @DiscriminatorColumn
    @Embeddable
    @Embedded
    @GenerateIdTable
    @SequenceGenerator
    @TableGenerator

    Java EE Compliant Annotations

     

     

    WebServices Service

    AnnotationComments

    @WebService

    @WebMethod

    @Oneway

    @WebParam

    @WebResult

    @HandlerChain

    @SOAPBinding

    JSR 181 Annotations

    @ServiceMode
    @WebFault
    @RequestWrapper
    @WebServiceClient
    @BindingType
    @WebServiceRef
    @WebServiceRefs
    @Action
    @FaultAction
    @WebServiceFeatureAnnotation
    @Addressing
    @MTOM
    @RespectBinding

    JSR 224 Annotations

    JBoss Specific Annotations

    EJB3 Service

     

    AnnotationComments

     

    Clustering Service

    AnnotationComments
    @ClusteredIndicates an EJB3 Session bean should have clustering behavior

    @Replicable

    @Serializable

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

    WebServices Service

    AnnotationComments

    @Documentation

    @EndpointConfig

    @FastInfoset

    @JsonEncoding

    @SchemaValidation

    JBWS-Native stack specific annotations

    @Policy

    @PolicyAttachment

    JBWS-Native WS-Policy annotations
    @WebContextDocumentation

    Microcontainer Service

    AnnotationComments

    org.jboss.beans.metadata.api.annotations.*

    @javax.inject.Inject

    @WeldEnabled

    @Weld

    Weld integration

    AOP Service

    AnnotationComments
    @AspectJBoss AOP defined annotations;
    @InterceptorDef
    @DynamicCFlowDef
    @Prepare
    @Precedence
    @PrecedenceInterceptor
    @PrecedenceAdvice
    @Bind
    @PointcutDef
    @Mixin
    @Introduction
    @TypeDef
    @CFlowStackDef
    @AnnotationIntroductionDef
    @DeclareWarning
    @DeclareError

     

     

    Profile Service

    AnnotationComments
    @ConstraintsPopulatorFactory
    @DefaultValueBuilderFactory
    @FieldsFactory
    @ManagementComponent
    @ManagementDeployment
    @ManagementObject
    @ManagementObjectClass
    @ManagementObjectID
    @ManagementObjectRef
    @ManagementOperation
    @ManagementParameter
    @ManagementProperty
    @ManagementPropertyFactory
    @ManagementRuntimeRef
    @Masked
    @RunStateProperty
    jboss-managed annotations
    @CompositeKey
    @CompositeValue
    @Generic
    @MetaMapping
    @MetaMappingFactory
    jboss-metatype annotations

     

     

    Seam Service

    AnnotationComments

    XML Files

    Java EE Specification Deployment Descriptors

     

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

     

    JBoss Specific Deployment Descriptors

     

    DescriptorComments
    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)

     

    DescriptorLocationComments
    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

     

    DescriptorComments

    jboss-wsse-server.xml

    jboss-wsse-client.xml

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

    standard-jaxws-endpoint-config.xml

    standard-jaxws-client-config.xml

    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 http://www.developer.com/java/ejb/article.php/10931_3670496_3/Packaging-EJB-3-Applications.htm .

    TODO: Merge to the tables above.

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

    See also:  http://docs.jboss.org/ejb3/app-server/reference/build/reference/en/html/partial_deployment_descriptors.html

     

    Annotation Type Annotation Element Corresponding Descriptor Element
    @StatelessEJB type<session-type>Stateless
    nameejb-name
    @StatefulEJB type<session-type>Stateful
    ejb-name
    @MessageDrivenEJB typemessage-driven
    nameejb-name
    @RemoteInterface typeremote
    @LocalInterface typelocal
    @Transaction-ManagementTransaction management type at bean leveltransaction-type
    @Transaction-AttributeTransaction settings methodcontainer-transaction trans-attribute
    @InterceptorsInterceptorsinterceptor-binding interceptor-class
    @ExcludeClass-InterceptorsInterceptorsexclude-class-interceptor
    @ExcludeDefault-InterceptorsInterceptorsexclude-default-interceptors
    @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.)
    resource-ref
    resource-env-ref
    message-destination-ref
    env-  ref
    Resource injectionSetter/field injectioninjection-target
    @EJBEJB referencesejb-ref
    ejb-local-ref
    @Persistence-ContextPersistence context referencepersistence-context-ref
    @PersistenceUnitPersistence unit referencepersistence-unit-ref