Jakarta Annotations

Jakarta Annotations (CA; formerly Common Annotations for the Java Platform or JSR 250) is a part of Jakarta EE. Originally created with the objective to develop Java annotations (that is, information about a software program that is not part of the program itself) for common semantic concepts in the Java SE and Java EE platforms that apply across a variety of individual technologies. It was envisioned that various JSRs would use annotations to enable a declarative style of programming. It would be especially valuable to have consistency within the Java EE component JSRs, but it is also valuable to allow consistency between Java EE and Java SE.

## Contents

* 1 Description and purpose
* 2 Dependencies to other JSRs
* 3 The annotations
* 4 Implementation
* 5 References

## Description and purpose

JSR 250, as a Java Specification Request, has the objective to define a set of annotations that address common semantic concepts and therefore can be used by many Java EE and Java SE components. This is to avoid redundant annotations across those components. JSR 250 was released on 11 May 2006. As Declarative annotation-driven configuration is more and more used in Java frameworks and applications, e.g. Spring makes more components of its framework configurable via annotations, the importance of JSR 250 is likely to increase in the future.

## Dependencies to other JSRs

JSR 250 depends on JSR 175 and therefore also on Java SE 5.0

## The annotations

Annotation name  | description

|

Generated  | Marks sources that have been generated
Resource  | Declares a reference to a resource, e.g. a database
Resources  | Container for multiple Resource annotations
PostConstruct  | Is used on methods that need to get executed after dependency injection is done to perform any initialization.
PreDestroy  | Is used on methods that are called before the instance is removed from the container
Priority  | Is used to indicate in what order the classes should be used. For, e.g., the Interceptors specification defines the use of priorities on interceptors to control the order in which interceptors are called.
RunAs  | Defines the role of the application during execution in a Java EE container
RolesAllowed  | Specifies the security roles permitted to access method(s) in an application.
PermitAll  | Specifies that all security roles are permitted to access the annotated method, or all methods in the annotated class.
DenyAll  | Specifies that no security roles are allowed to invoke the specified method(s).
DeclareRoles  | Used to specify the security roles by the application.
DataSourceDefinition  | Is used to define a container DataSource and be registered with JNDI. The DataSource may be configured by setting the annotation elements for commonly used DataSource properties.
ManagedBean  | Is used to declare a Managed Bean which are container managed objects that support a small set of basic services such as resource injection, lifecycle callbacks and interceptors.

## Implementation

All non-Java EE JSR 250 annotations were added to the Java SE with version 6 (Generated, PostConstruct, PreDestroy, Resource, Resources). They are located in the package javax.annotation. They were subsequently deprecated in Java SE 9 and removed in Java SE 11, however, they are effectively continued, being renamed to `jakarta.annotation` in Jakarta EE 9.

## References

* Jakarta Annotations
* JSR 250: Common Annotations for the Java Platform

* v
* t
* e

Jakarta EE specifications

Web app|

* Servlet
* Server Pages
* Expression Language
* JSTL
* Server Faces
* WebSocket

Enterprise app|

* Dependency injection
* Bean Validation
* Enterprise Beans
* JPA
* JMS
* JTA
* Mail
* JCA
* Common Annotations

Web services|

* JAX-RS
* JAX-WS
* SOAP with Attachments
* Web Services Metadata
* JAXM
* JAXR

APM|

* Management

Other|

* JAXB
* JAX-RPC
* JAF

Related|

* JAXP
* JDBC
* JMX
* Streaming API for XML

0.00

(0 votes)

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Jakarta_Annotations&oldid=3908024"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template