From 690eb00aecec4de3de802546c04eb7a4b194e234 Mon Sep 17 00:00:00 2001 From: mxd <838425805@qq.com> Date: Mon, 21 Jun 2021 21:18:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=93=E5=8D=B0`URL`?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E4=B8=80=E4=B8=AA`/`=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spring/boot/starter/ApplicationUriPrinter.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/magic-api-spring-boot-starter/src/main/java/org/ssssssss/magicapi/spring/boot/starter/ApplicationUriPrinter.java b/magic-api-spring-boot-starter/src/main/java/org/ssssssss/magicapi/spring/boot/starter/ApplicationUriPrinter.java index 98ccc42b..57dd6e98 100644 --- a/magic-api-spring-boot-starter/src/main/java/org/ssssssss/magicapi/spring/boot/starter/ApplicationUriPrinter.java +++ b/magic-api-spring-boot-starter/src/main/java/org/ssssssss/magicapi/spring/boot/starter/ApplicationUriPrinter.java @@ -42,15 +42,16 @@ public class ApplicationUriPrinter implements CommandLineRunner { String port = springEnv.getProperty("server.port", "port"); String path = springEnv.getProperty("server.servlet.context-path", ""); String magicWebPath = properties.getWeb(); - String localUrl = PathUtils.replaceSlash(String.format("http://localhost:%s/%s/%s/",port,path, Objects.toString(properties.getPrefix(),""))); - String externUrl = PathUtils.replaceSlash(String.format("http://%s:%s/%s/%s/",ip,port,path, Objects.toString(properties.getPrefix(),""))); + String schema = "http://"; + String localUrl = schema + PathUtils.replaceSlash(String.format("localhost:%s/%s/%s/",port,path, Objects.toString(properties.getPrefix(),""))); + String externUrl = schema + PathUtils.replaceSlash(String.format("%s:%s/%s/%s/",ip,port,path, Objects.toString(properties.getPrefix(),""))); System.out.println( "服务启动成功,magic-api已内置启动! Access URLs:\n\t" + "接口本地地址: \t\t"+localUrl+"\n\t" + "接口外部访问地址: \t" + externUrl ); if (!StringUtils.isEmpty(magicWebPath)) { - String webPath = PathUtils.replaceSlash(String.format("http://%s:%s/%s/%s/index.html", ip, port, path, magicWebPath)); + String webPath = schema + PathUtils.replaceSlash(String.format("%s:%s/%s/%s/index.html", ip, port, path, magicWebPath)); System.out.println("\t接口配置平台: \t\t" + webPath); } System.out.println("\t可通过配置关闭输出: \tmagic-api.show-url=false");