Common annotations for the Java platform
The common annotations for the Java platform 1.2 Specification was developed under JSR 250. This section just gives you an overview of improvements in the API. The complete document specification (for more information) can be downloaded from http://jcp.org/aboutJava/communityprocess/mrel/jsr250/index.html.
The goal of this specification
Annotations are a form of metadata that are generally used to describe, configure, or mark elements (such as class, method, and attribute) of Java code. In the following code, we use the @Stateless
annotation to configure MySessionBean
class as a stateless session bean, we use the @Deprecated
annotation to mark oldMethod()
method as obsolete, and finally we set the save()
method with the
@TransactionAttribute
annotation so that it will always use a dedicated transaction.
@Stateless public class MySessionBean { @Deprecated public void oldMethod(){} @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW...