Jakarta Annotations

Last updated

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

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 namedescription
GeneratedMarks sources that have been generated
ResourceDeclares a reference to a resource, e.g. a database
ResourcesContainer for multiple Resource annotations
PostConstructIs used on methods that need to get executed after dependency injection is done to perform any initialization.
PreDestroyIs used on methods that are called before the instance is removed from the container
PriorityIs 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.
RunAsDefines the role of the application during execution in a Java EE container
RolesAllowedSpecifies the security roles permitted to access method(s) in an application.
PermitAllSpecifies that all security roles are permitted to access the annotated method, or all methods in the annotated class.
DenyAllSpecifies that no security roles are allowed to invoke the specified method(s).
DeclareRolesUsed to specify the security roles by the application.
DataSourceDefinitionIs 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.
ManagedBeanIs 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.

Related Research Articles

Jakarta Enterprise Beans is one of several Java APIs for modular construction of enterprise software. EJB is a server-side software component that encapsulates business logic of an application. An EJB web container provides a runtime environment for web related software components, including computer security, Java servlet lifecycle management, transaction processing, and other web services. The EJB specification is a subset of the Java EE specification.

The Jakarta Transactions, one of the Jakarta EE APIs, enables distributed transactions to be done across multiple X/Open XA resources in a Java environment. JTA was a specification developed under the Java Community Process as JSR 907. JTA provides for:

The Jakarta Messaging API is a Java application programming interface (API) for message-oriented middleware. It provides generic messaging models, able to handle the producer–consumer problem, that can be used to facilitate the sending and receiving of messages between software systems. Jakarta Messaging is a part of Jakarta EE and was originally defined by a specification developed at Sun Microsystems before being guided by the Java Community Process.

Jakarta EE

Jakarta EE, formerly Java Platform, Enterprise Edition and Java 2 Platform, Enterprise Edition (J2EE), is a set of specifications, extending Java SE with specifications for enterprise features such as distributed computing and web services. Jakarta EE applications are run on reference runtimes, that can be microservices or application servers, which handle transactions, security, scalability, concurrency and management of the components it is deploying.

Java Platform, Standard Edition is a computing platform for development and deployment of portable code for desktop and server environments. Java SE was formerly known as Java 2 Platform, Standard Edition (J2SE).

NetBeans Integrated development environment software for software development

NetBeans is an integrated development environment (IDE) for Java. NetBeans allows applications to be developed from a set of modular software components called modules. NetBeans runs on Windows, macOS, Linux and Solaris. In addition to Java development, it has extensions for other languages like PHP, C, C++, HTML5, and JavaScript. Applications based on NetBeans, including the NetBeans IDE, can be extended by third party developers.

Jakarta Server Faces

Jakarta Server Faces is a Java specification for building component-based user interfaces for web applications and was formalized as a standard through the Java Community Process being part of the Java Platform, Enterprise Edition. It is also an MVC web framework that simplifies construction of user interfaces (UI) for server-based applications by using reusable UI components in a page.

Jakarta XML Binding is a software framework that allows Jakarta EE developers to map Java classes to XML representations. JAXB provides two main features: the ability to marshal Java objects into XML and the inverse, i.e. to unmarshal XML back into Java objects. In other words, JAXB allows storing and retrieving data in memory in any XML format, without the need to implement a specific set of XML loading and saving routines for the program's class structure. It is similar to xsd.exe and XmlSerializer in the .NET Framework.

Jakarta Connectors is a Java programming language tool for connecting application servers and enterprise information systems (EIS) as part of enterprise application integration (EAI). While JDBC is specifically used to connect Java applications to databases, JCA is a more generic architecture for connection to legacy systems. JCA was developed under the Java Community Process as JSR 16, JSR 112 and JSR 322.

The Bean Scripting Framework is a method of allowing the use of scripting in Java code. It provides a set of Java classes which provides support within Java applications for scripting languages, and also allows access to Java objects and methods. Some examples of languages that can be used in combination with BSF and Java include Python, Jython and Tcl, as well as JRuby and Apache Groovy using their own libraries.

The Metadata Facility for Java is a specification for Java that defines an API for annotating fields, methods, and classes as having particular attributes that indicate they should be processed in specific ways by development tools, deployment tools, or run-time libraries.

GlassFish

GlassFish is an open-source Jakarta EE platform application server project started by Sun Microsystems, then sponsored by Oracle Corporation, and now living at the Eclipse Foundation and supported by Payara, Oracle and Red Hat. The supported version under Oracle was called Oracle GlassFish Server. GlassFish is free software and was initially dual-licensed under two free software licences: the Common Development and Distribution License (CDDL) and the GNU General Public License (GPL) with the Classpath exception. After having been transferred to Eclipse, GlassFish remained dual-licensed, but the CDDL license was replaced by the Eclipse Public License (EPL).

Java (software platform) Set of computer software and specifications

Java is a set of computer software and specifications developed by James Gosling at Sun Microsystems, which was later acquired by the Oracle Corporation, that provides a system for developing application software and deploying it in a cross-platform computing environment. Java is used in a wide variety of computing platforms from embedded devices and mobile phones to enterprise servers and supercomputers. Java applets, which are less common than standalone Java applications, were commonly run in secure, sandboxed environments to provide many features of native applications through being embedded in HTML pages. It makes the website more dynamic.

The Jakarta XML Web Services is a Jakarta EE API for creating web services, particularly SOAP services. JAX-WS is one of the Java XML programming APIs.

Jakarta Persistence is a Jakarta EE application programming interface specification that describes the management of relational data in enterprise Java applications.

The Jakarta Expression Language is a special purpose programming language mostly used in Jakarta EE web applications for embedding and evaluating expressions in web pages. The specification writers and expert groups of the Java EE web-tier technologies have worked on a unified expression language which was first included in the JSP 2.1 specification (JSR-245), and later specified by itself in JSR-341, part of Java EE 7.

Jakarta RESTful Web Services, is a Jakarta EE API specification that provides support in creating web services according to the Representational State Transfer (REST) architectural pattern. JAX-RS uses annotations, introduced in Java SE 5, to simplify the development and deployment of web service clients and endpoints.

The JBoss Enterprise Application Platform is a subscription-based/open-source Java EE-based application server runtime platform used for building, deploying, and hosting highly-transactional Java applications and services developed and maintained by Red Hat. The JBoss Enterprise Application Platform is part of Red Hat's Enterprise Middleware portfolio of software. Because it is Java-based, the JBoss application server operates across platforms; it is usable on any operating system that supports Java. JBoss Enterprise Application Platform was originally called JBoss and was developed by the eponymous company JBoss, acquired by Red Hat in 2006

Jakarta Web Services Metadata, as a part of Jakarta XML Web Services (JAX-WS), is a Java programming language specification (JSR-181) primarily used to standardize the development of web service interfaces for the Jakarta EE platform.

Jakarta Management is a Java specification request (JSR-77) for standardization of Jakarta EE server management. Jakarta Management abstracts the manageable parts of the Jakarta EE architecture and defines an interface for accessing management information. This helps system administrators integrate Jakarta EE servers into a system management environment and also helps application developers create their own management tools from scratch.

References