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
Annotation | Comments |
---|---|
@MessageDriven | Component-defining annotation for a message driven bean. |
@Singleton | Component-defining annotation for a singleton session bean. |
@Stateful | Component-defining annotation for a stateful session bean. |
@Stateless | Component-defining annotation for a stateful session bean. |
Bean Annotations
Annotation | Comments |
---|---|
@AccessTimeout | Specifies the amount of time in a given time unit that a concurrent access attempt should block before timing out. |
@ActivationConfigProperty | Designate a configuration property on a message driven bean. |
@AfterBegin | Designate a stateful session bean method to receive the AfterBegin Session Synchronization callback. |
@AfterCompletion | Designate a stateful session bean method to receive the AfterCompletion Session Synchronization callback. |
@ApplicationException | Applied to an exception to denote that it is an application exception and should be reported to the client directly(i.e., unwrapped). |
@Asynchronous | Used to mark a method as an asynchronous method or to designate all business methods of a class or interface as asynchronous. |
@BeforeCompletion | Designate a stateful session bean method to receive the BeforeCompletion Session Synchronization callback. |
@ConcurrencyManagement | Declares a Singleton or Stateful session bean's concurrency management type. |
@DependsOn | Used to express an initialization dependency between Singleton components. |
@Init | Designates a method of a session bean that corresponds to the create method of an adapted Home interface or an adapted Local Home interface. |
@Local | When used on the bean class, declares the local business interface(s) for a session bean. |
@LocalBean | Designates that a session bean exposes a no-interface view. |
@LocalHome | Declares the Local Home or adapted Local Home interface for a session bean. |
@Lock | Declares a concurrency lock for a singleton method. |
@PostActivate | Designates a method to receive a callback after a stateful session bean has been activated. |
@PrePassivate | Designates a method to receive a callback before a stateful session bean is passivated. |
@Remote | Declares the remote business interface(s) for a session bean. |
@RemoteHome | Declares the Remote Home interface or adapted Remote Home interface for a session bean. |
@Remove | Applied to a business method of a stateful session bean class. |
@Schedule | Schedule a timer for automatic creation with a timeout schedule based on a cron-like time expression. |
@Schedules | Schedules multiple timers that use the same method as the timeout callback method. |
@Startup | Mark a Singleton for eager loading during application initialization. |
@StatefulTimeout | Specifies 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. |
@Timeout | Designates a method on a stateless session bean class or message driven bean class that should receive EJB timer expirations for that bean. |
@TransactionAttribute | When applied at the TYPE-level, designates the default transaction attribute for all business methods of the session or message driven bean. |
@TransactionManagement | Declares 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 |
---|---|
@EJB | Indicates a dependency on the local, no-interface, or remote view of an Enterprise Java Bean. |
@EJBs | Declares multiple TYPE-level @EJB annotations. |
JBoss Extension Annotations
Annotation | Comments |
---|---|
@Clustered | Indicates an EJB3 Session bean should have clustering behavior |
ToDo | ToDo |
TODO: these need to be removed from the EJB 3 section
Annotation | Comments |
---|---|
@Stateless @TransactionManagement @MethodPermissions @CallBackListener @Resource @Interceptor @ManyToOne @OneToOne @AssociationTable | Java EE Compliant Annotations |
WebServices Service
Annotation | Comments |
---|---|
@WebService @WebMethod @Oneway @WebParam @WebResult @HandlerChain @SOAPBinding | JSR 181 Annotations |
@ServiceMode | JSR 224 Annotations |
JBoss Specific Annotations
EJB3 Service
Annotation | Comments |
---|---|
Clustering Service
Annotation | Comments |
---|---|
@Clustered | Indicates 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
Annotation | Comments |
---|---|
@Documentation @EndpointConfig @FastInfoset @JsonEncoding @SchemaValidation | JBWS-Native stack specific annotations |
@Policy @PolicyAttachment | JBWS-Native WS-Policy annotations |
@WebContext | Documentation |
Microcontainer Service
Annotation | Comments |
---|---|
org.jboss.beans.metadata.api.annotations.* | |
@javax.inject.Inject | |
@WeldEnabled @Weld | Weld integration |
AOP Service
Annotation | Comments |
---|---|
@Aspect | JBoss AOP defined annotations; |
@InterceptorDef | |
@DynamicCFlowDef | |
@Prepare | |
@Precedence | |
@PrecedenceInterceptor | |
@PrecedenceAdvice | |
@Bind | |
@PointcutDef | |
@Mixin | |
@Introduction | |
@TypeDef | |
@CFlowStackDef | |
@AnnotationIntroductionDef | |
@DeclareWarning | |
@DeclareError |
Profile Service
Annotation | Comments |
---|---|
@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
Annotation | Comments |
---|---|
XML Files
Java EE Specification Deployment Descriptors
Descriptor | Comments |
---|---|
web.xml | Web Application |
ejb-jar.xml | EJB Application |
application.xml | Enterprise Archive |
ra.xml | Resource Adapter (RA) |
webservices.xml | JavaEE 1.4 Web Services |
JBoss Specific Deployment Descriptors
Descriptor | Comments |
---|---|
jboss-app.xml | Enterprise Archive (EAR) |
jboss-web.xml | Web Application |
jboss.xml | EJB Application |
jboss-ra.xml | Resource Adapter (RA) |
jboss-service.xml | Service Archive (SAR) - JBoss Archive |
xxx-jboss-beans.xml | MC Beans |
xxx-aop.xml | Resolves pointcut and advice bindings for JBoss AOP |
JBoss Server Configuration Deployment Descriptors (For System Administrators)
Descriptor | Location | Comments |
---|---|---|
bootstrap.xml | conf | The list of URLs for mc beans to load during bootstrap. |
logging.xml | conf/bootstrap | Configures the Logging Subsystem |
aop.xml | conf/bootstrap | Configures the AOP Subsystem |
profile.xml | conf/bootstrap | Configures profile service (where deployers dir is, where deploy dir is, what files are watched for changes, etc) |
deployers.xml | conf/bootstrap | Deployers' configuration (file extensions, patterns of DDs) |
WebService Descriptors
Descriptor | Comments |
---|---|
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.xml | The 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)
Annotation | Type | Annotation Element | Corresponding Descriptor Element |
---|---|---|---|
@Stateless | EJB type | <session-type>Stateless | |
name | ejb-name | ||
@Stateful | EJB type | <session-type>Stateful | |
ejb-name | |||
@MessageDriven | EJB type | message-driven | |
name | ejb-name | ||
@Remote | Interface type | remote | |
@Local | Interface type | local | |
@Transaction-Management | Transaction management type at bean level | transaction-type | |
@Transaction-Attribute | Transaction settings method | container-transaction trans-attribute | |
@Interceptors | Interceptors | interceptor-binding interceptor-class | |
@ExcludeClass-Interceptors | Interceptors | exclude-class-interceptor | |
@ExcludeDefault-Interceptors | Interceptors | exclude-default-interceptors | |
@AroundInvoke | Custom interceptor | around-invoke | |
@PreConstruct | Lifecycle method | pre-construct | |
@PostDestroy | Lifecycle method | post-destroy | |
@PostActivate | Lifecycle method | post-activate | |
@PrePassivate | Lifecycle method | pre-passivate | |
@DeclareRoles | Security setting | security-role | |
@RolesAllowed | Security setting | method-permission | |
@PermitAll | Security setting | unchecked | |
@DenyAll | Security setting | exclude-list | |
@RunAs | Security setting | security-identity run-as | |
@Resource | Resource references (DataSource, JMS, Environment, mail, etc.) | resource-ref resource-env-ref message-destination-ref env- ref | |
Resource injection | Setter/field injection | injection-target | |
@EJB | EJB references | ejb-ref ejb-local-ref | |
@Persistence-Context | Persistence context reference | persistence-context-ref | |
@PersistenceUnit | Persistence unit reference | persistence-unit-ref |
Comments