瀏覽代碼

更新版本记录信息

keyuan 4 年之前
父節點
當前提交
3885e65fc8

+ 10 - 20
src/main/java/com/key/common/plugs/version/VersionInfo.java

@@ -7,40 +7,30 @@ import java.util.Properties;
 public class VersionInfo {
 
 
-    private static final String versionInfo;
+    private static String versionInfo;
 
-    private static final String versionBuilt;
+    private static String versionBuilt;
 
-    private static final String versionNumber;
+    private static String versionNumber;
 
-    static {
+    public static void initVersionInfo (Properties props) {
 
         String info = null;
         String built = null;
         String number = null;
 
-        Properties props = new Properties();
-
-        try {
-            InputStream is = VersionInfo.class.getResourceAsStream("/com/key/common/plugs/version/VersionInfo.properties");
-
-            if(is!=null){
-                props.load(is);
-                info = props.getProperty("version.info");
-                built = props.getProperty("version.built");
-                number = props.getProperty("version.number");
-            }
-
-        } catch (IOException e) {
-            e.printStackTrace();
+        if(props!=null){
+            info = props.getProperty("dw.version.info");
+            built = props.getProperty("dw.version.built");
+            number = props.getProperty("dw.version.number");
         }
 
         if (info == null || info.equals("DWSurvey OSS @VERSION@"))
-            info = "DWSurvey OSS V3.1.0-dev";
+            info = "DWSurvey OSS V3.2.0-dev";
         if (built == null || built.equals("@VERSION_BUILT@"))
             built = "unknown";
         if (number == null || number.equals("@VERSION_NUMBER@"))
-            number = "3.1.x";
+            number = "3.2.x";
 
         versionInfo = info;
         versionBuilt = built;

+ 3 - 3
src/main/java/com/key/common/plugs/version/VersionInfo.properties

@@ -1,3 +1,3 @@
-version.info=DWSurvey OSS @VERSION@
-version.number=@VERSION_NUMBER@
-version.built=@VERSION_BUILT@
+dw.version.info=DWSurvey OSS @VERSION@
+dw.version.number=@VERSION_NUMBER@
+dw.version.built=@VERSION_BUILT@

+ 5 - 2
src/main/java/com/key/common/utils/DiaowenProperty.java

@@ -7,6 +7,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
+import com.key.common.plugs.version.VersionInfo;
 import com.key.common.utils.web.Struts2Utils;
 import org.apache.struts2.ServletActionContext;
 import org.springframework.beans.BeansException;
@@ -19,7 +20,7 @@ import com.sun.org.apache.xml.internal.security.Init;
 import javax.servlet.ServletContext;
 
 /**
- * 
+ *
  * @author keyuan
  *
  */
@@ -36,7 +37,7 @@ public class DiaowenProperty extends
 			ConfigurableListableBeanFactory beanFactoryToProcess,
 			Properties props) throws BeansException {
 		super.processProperties(beanFactoryToProcess, props);
-		
+
 		/*
 		ctxPropertiesMap = new HashMap<String, String>();
 		for (Object key : props.keySet()) {
@@ -45,6 +46,7 @@ public class DiaowenProperty extends
 			ctxPropertiesMap.put(keyStr, value);
 		}
 		*/
+		VersionInfo.initVersionInfo(props);
 	}
 /*
 	public static String getContextProperty(String name) {
@@ -55,4 +57,5 @@ public class DiaowenProperty extends
 		System.out.println(ServletActionContext.getContext());
 	}
 
+
 }

+ 5 - 1
src/main/resources/conf/application.properties

@@ -1,7 +1,7 @@
 #simple settings
 ###-------------------------------------DW------------------------------###
 #database settings
-jdbc.driver=com.mysql.jdbc.Driver
+jdbc.driver=com.mysql.cj.jdbc.Driver
 jdbc.url=jdbc:mysql://localhost:3306/dwsurvey?useUnicode=true&characterEncoding=utf8
 jdbc.username=root
 jdbc.password=123456,.
@@ -10,3 +10,7 @@ hibernate.show_sql=false
 hibernate.format_sql=true
 ###-------------------------------------DW------------------------------###
 dw.storage.url_prefix =
+###-------------------------------------版本信息------------------------------###
+dw.version.info=DWSurvey OSS @VERSION@
+dw.version.number=@VERSION_NUMBER@
+dw.version.built=@VERSION_BUILT@