Browse Source

解决配置文件读取乱码

rayson 1 năm trước cách đây
mục cha
commit
0f9ae89dd8

+ 3 - 1
src/main/java/com/thinkgem/jeesite/common/utils/PropertiesLoader.java

@@ -5,8 +5,10 @@
  */
 package com.thinkgem.jeesite.common.utils;
 
+import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.util.NoSuchElementException;
 import java.util.Properties;
 
@@ -142,7 +144,7 @@ public class PropertiesLoader {
 			try {
 				Resource resource = resourceLoader.getResource(location);
 				is = resource.getInputStream();
-				props.load(is);
+				props.load(new BufferedReader(new InputStreamReader(is,"utf-8")));
 			} catch (IOException ex) {
 				logger.info("Could not load properties from path:" + location + ", " + ex.getMessage());
 			} finally {

+ 3 - 3
src/main/resources/mybatis-refresh.properties

@@ -1,8 +1,8 @@
 # enabled
 enabled=true
-# project start time[\u9879\u76ee\u542f\u52a8\u65f6\u95f4]
+# project start time[项目启动时间]
 delaySeconds=5
-# xml scanning interval time[\u626b\u63cf\u95f4\u9694\u65f6\u957f]
+# xml scanning interval time[扫描间隔时长]
 sleepSeconds=2
-# xml file's path[xml\u6587\u4ef6\u7684\u8def\u5f84]
+# xml file's path[xml文件的路径]
 mappingPath=mappings