Java EE5 and Java EE 6 support for annotations
2012-02-09 12:02
162 查看
Java EE5 and Java EE 6 support for annotations
The goal of Java™ EE5 and Java EE 6 platform development is to minimizethe number of artifacts that you have to create and maintain, therebysimplifying the development process. Java EE5 and Java EE 6 support the injection of annotationsintoyour source code, so that you can embed resources, dependencies,services, and life-cycle notifications in your source code, withouthaving to maintain these artifacts elsewhere.
An annotation is a modifier or Metadata tag that provides additionaldata to Java classes, interfaces, constructors,methods, fields, parameters, and local variables. Annotations replaceboilerplate code, common code that is required by certain applications.For
example, an annotation can replace the paired interface and implementationrequired for a Web service. Annotations can also replace additionalfiles that programs require, which are maintained separately. By usingan annotation, this separate file is no longer
required. For example,annotations can replace the need for a separately maintained deploymentdescriptor for JavaBeans™.
Annotations
Replace descriptors for most purposes
Remove the need for marker interfaces (like java.rmi.Remote)
Allow application settings to be visible in the component theyaffect
Java EE 5 provides annotations for the following tasks, among others:
Developing Enterprise JavaBean applications
Defining and using Web services
Mapping Java technology classes to XML
Mapping Java technology classes to databases
Mapping methods to operations
Specifying external dependencies
Specirying deployment information, including security attributes
Java EE 5 defines a number of annotations thatcan be injected into your source code. To declare an annotation, yousimply precede the keyword with an "at" sign (@).
package com.ibm.counter; import javax.ejb.Stateless; @Stateless public class CounterBean { }
相关文章推荐
- Java Reflection Tutorial for Classes, Methods, Fields, Constructors, Annotations and much more
- Contexts and Dependency Injection for the Java EE Platform(CDI,JSR-299)
- Configuring Java CAPS for SSL Support - KeyStores and TrustStores
- java.lang.IllegalStateException: Async support must be enabled on a servlet and for all filters invo
- How to support both ipv4 and ipv6 address for JAVA code.
- Embedded Jetty and Spring: The Lightweight Antidote for Java EE Complexity
- Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules
- Implement regular expression matching with support for '.' and '*'.
- Eclipse Java EE IDE for Web Developers.配置Tomcat全攻略
- A fast dependency injector for Android and Java Dagger (依赖注入)使用的一些个人总结
- Java Annotations, Java Reflection, and Java Test Runner
- Eclipse Java EE IDE for Web Developers + pache-tomcat-6.0.32
- linux下用eclipse ide for java ee第一个web project记录
- Filthy Rich Clients: Developing Animated and Graphical Effects for Desktop Java(TM) Applications
- 加载web项目时报的错误:Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modul
- 【笔记】Eclipse and Java for Total Beginners—008
- 【笔记】Eclipse and Java for Total Beginners—015
- JBoss(R) Seam: Simplicity and Power Beyond Java(TM) EE
- 经典版eclipse增加web and JavaEE插件
- Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules