Annotation-based programming overview
Annotation-based programming is an extensible mechanism for generating application artifacts, packaging the application, and readying the application for execution. Annotation-based programming offers a set of tags and a processing mechanism that allow you to embed additional metadata in your Java™ source code. Your application then uses this additional metadata to derive the artifacts required to execute the application in a J2EE environment.
Goal of annotation-based programming
The goal of annotation-based programming is to minimize the number of artifacts that you have to create and maintain, thereby simplifying the development process.
- the home and remote interface classes
- a stateless session implementation wrapper class
- the EJB deployment descriptor (ejb-jar.xml)
- the WebSphere-specific binding data
- all the remaining artifacts required to produce a compliant J2EE application
/**
* @ejb.interface-method view-type=remote
*/
public String hello(String name)
{
return "Hello: " + name;
}
where @ejb.interface-method view-type=remote is an example of an annotation tag.
Annotation Tags
Annotations are Javadoc-style comments that you embed within the Java source file. You can include annotations in the package, class, field, or method declarations. In addition, the tag syntax of XDoclet is supported. For more information, see XDoclet.
- EJBs
- Servlets
- Java classes
- Web services