|
@@ -5,7 +5,8 @@ import org.dbsyncer.biz.MappingService;
|
|
import org.dbsyncer.biz.vo.RestResult;
|
|
import org.dbsyncer.biz.vo.RestResult;
|
|
import org.dbsyncer.biz.vo.VersionVo;
|
|
import org.dbsyncer.biz.vo.VersionVo;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
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.stereotype.Controller;
|
|
import org.springframework.ui.ModelMap;
|
|
import org.springframework.ui.ModelMap;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
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 org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
|
|
|
@Controller
|
|
@Controller
|
|
@RequestMapping("/index")
|
|
@RequestMapping("/index")
|
|
|
|
+@ConfigurationProperties(prefix = "info.app")
|
|
public class IndexController {
|
|
public class IndexController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -24,11 +27,9 @@ public class IndexController {
|
|
@Autowired
|
|
@Autowired
|
|
private MappingService mappingService;
|
|
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("")
|
|
@GetMapping("")
|
|
public String index(HttpServletRequest request, ModelMap model) {
|
|
public String index(HttpServletRequest request, ModelMap model) {
|
|
@@ -39,8 +40,23 @@ public class IndexController {
|
|
|
|
|
|
@GetMapping("/version.json")
|
|
@GetMapping("/version.json")
|
|
@ResponseBody
|
|
@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;
|
|
|
|
+ }
|
|
}
|
|
}
|