竹直心虚乃吾友,水淡性泊是我师!
山不厌高,水不厌深
Google
 
posts - 3,comments - 1,trackbacks - 0

先看代码
core包中的SpringVersion.java

public class SpringVersion {
 /**
  * Return the full Spring version string.
  * @see java.lang.Package#getImplementationVersion
  */
 public static String getVersion() {
  return SpringVersion.class.getPackage().getImplementationVersion();
 }
}

SpringVersion.class.getPackage().getImplementationVersion();
这一句会返回什么信息呢?我使用得是Spring1.2.6,返回如下信息.
-----
1.2.6
-----
那么这个信息又是从什么地方来的呢?
这个就要说到产品的发布.产品发布会打成一个JAR包.JAR除了包含.class文件外,还包括一个META-INF文件夹.它下面又包含了一个MANIFEST.MF的文件.它包含了这个产品的产品信息.现在看看这个文件里都有什么吧
-----------------------
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_05-b05 (Sun Microsystems Inc.)
Implementation-Title: Spring Framework
Implementation-Version: 1.2.6
Spring-Version: 1.2.6
-----------------------

现在知道getImplementationVersion()是从哪里取东东了吧:)

posted on 2007-07-23 13:34 JAVA虚拟机 阅读(438) 评论(0)  编辑  收藏 所属分类: Spring的核心概念

只有注册用户登录后才能发表评论。


网站导航: