Reputation: 3923
What is the purpose of JSR-250 annotations in Java SE environment?
How to make use of them in a non-spring and non-java-ee environment?
Upvotes: 0
Views: 87
Reputation: 23
The @Annotation facility in Java was initially developed for usage in the Java Enterprise (EE/J2EE) context. It fundamentally differs whether a Java class is stateless, thereby initialized again with each user session (thread), or a singleton class with one particular state, common to all users. Clearly, this distinction is necessary in a multi-user setting of a web-application. During the course of development of Java EE, several new annotation types were added, and the workings of some annotations were changed.
The @Annotation API allows the definition of user-defined annotations, useful for Content Dependent Injection (CDI), during start-up of a Java-application. For a tutorial on the usage of annotations in CDI, see annotation-HowTo.
The @Annotation API implements formal semantics for compilation, deployment and (JNDI) linking of Java classes. However, as the development of JPA has shown, the @Anniotation API can be extended with useful parameters that configure the way entities are managed, or other semantic directives.
At present, I'm implementing a semantics for application logic, using extensive newly defined @Annotations, including different parameters (methods in the @interface-file). I will later report here regarding the progress of this project.
Upvotes: 2