Jelajahi Sumber

修复配置文件编码

AE86 3 tahun lalu
induk
melakukan
fc46c09b55

+ 1 - 1
dbsyncer-connector/src/main/resources/META-INF/spring.factories

@@ -1,3 +1,3 @@
-# 在这里开启自动状态,遵循spring 扫描规则
+# 鍦ㄨ繖閲屽紑鍚�嚜鍔ㄧ姸鎬侊紝閬靛惊spring 鎵�弿瑙勫垯
 org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
 org.dbsyncer.connector.AutoConfiguration

+ 23 - 7
dbsyncer-web/src/main/java/org/dbsyncer/web/controller/index/IndexController.java

@@ -5,7 +5,8 @@ import org.dbsyncer.biz.MappingService;
 import org.dbsyncer.biz.vo.RestResult;
 import org.dbsyncer.biz.vo.VersionVo;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.PropertySource;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -13,9 +14,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.UnsupportedEncodingException;
 
 @Controller
 @RequestMapping("/index")
+@ConfigurationProperties(prefix = "info.app")
 public class IndexController {
 
     @Autowired
@@ -24,11 +27,9 @@ public class IndexController {
     @Autowired
     private MappingService mappingService;
 
-    @Value(value = "${info.app.name}")
-    private String appName;
+    private String name;
 
-    @Value(value = "${info.app.copyright}")
-    private String appCopyRight;
+    private String copyright;
 
     @GetMapping("")
     public String index(HttpServletRequest request, ModelMap model) {
@@ -39,8 +40,23 @@ public class IndexController {
 
     @GetMapping("/version.json")
     @ResponseBody
-    public RestResult version() {
-        return RestResult.restSuccess(new VersionVo(appName, appCopyRight));
+    public RestResult version() throws UnsupportedEncodingException {
+        return RestResult.restSuccess(new VersionVo(name, copyright));
     }
 
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getCopyright() {
+        return copyright;
+    }
+
+    public void setCopyright(String copyright) {
+        this.copyright = copyright;
+    }
 }

+ 1 - 1
dbsyncer-web/src/main/resources/application.properties

@@ -19,7 +19,7 @@ management.endpoints.web.base-path=/app
 management.endpoints.web.exposure.include=*
 management.endpoint.health.show-details=always
 management.health.elasticsearch.enabled=false
-info.app.name=DBSyncer
+info.app.name=DBSyncer\u6570\u636E\u540C\u6B65\u670D\u52A1
 info.app.version=1.1.8-Beta
 info.app.copyright=&copy;2022 ${info.app.name}(${info.app.version})<footer>Designed By <a href='https://gitee.com/ghi/dbsyncer' target='_blank' >AE86</a></footer>