很多开发人员都在不停的抱怨他们不得不管理数量众多的XML配置文件。随着java新版JDK(Tiger)带来新的元数据,那些框架下的公共配置将通过annotation写入到java源代码中。
在这篇文章中我们将通过一个数据验证框架的例子来回顾现有的配置数据管理,以及元数据将给我们带来那些好处。
Many developers have been complaining about having to manage numerous XML configuration files alongside their Java code. With the recent addition of metadata to Java, common configuration details in frameworks can now be rolled right into your Java files through annotations. For a brief introduction to metadata and annotations, see Sun's article "J2SE 5.0 in a Nutshell."
In this article, we will summarize how configuration data is managed today and what metadata will offer in the future, followed by an implementation of how annotations can be used in a simple validation framework
原文见:http://www.onjava.com/pub/a/onjava/2005/01/19/metadata_validation.html
(另:在第二期的java电子杂志里也将专门论述annotation)
本文地址:http://com.8s8s.com/it/it11634.htm