Browse Source

fix:issues/414 设置contextPath后演示地址未及时更新 (#415)

pull/41/MERGE
fuzi 2 years ago committed by GitHub
parent
commit
281a9cfbab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      server/src/main/java/cn/keking/ServerMain.java

9
server/src/main/java/cn/keking/ServerMain.java

@ -1,5 +1,6 @@
package cn.keking;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -24,8 +25,12 @@ public class ServerMain {
.logStartupInfo(false)
.run(args);
stopWatch.stop();
Integer port = context.getBean(ServerProperties.class).getPort();
logger.info("kkFileView 服务启动完成,耗时:{}s,演示页请访问: http://127.0.0.1:{} ", stopWatch.getTotalTimeSeconds(), port);
ServerProperties serverProperties = context.getBean(ServerProperties.class);
Integer port = serverProperties.getPort();
ServerProperties.Servlet servlet = serverProperties.getServlet();
String contextPath = servlet.getContextPath();
String urlSuffix = StringUtils.isBlank(contextPath)? String.valueOf(port):port+contextPath;
logger.info("kkFileView 服务启动完成,耗时:{}s,演示页请访问: http://127.0.0.1:{} ", stopWatch.getTotalTimeSeconds(), urlSuffix);
}
}

Loading…
Cancel
Save