动态获取演示页访问地址的端口信息

This commit is contained in:
kl 2021-02-04 11:38:45 +08:00
parent d61e5236d0
commit d01dddf9e3
2 changed files with 17 additions and 17 deletions

View File

@ -4,6 +4,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.util.StopWatch;
@ -13,23 +14,17 @@ import org.springframework.util.StopWatch;
@ComponentScan(value = "cn.keking.*")
public class ServerMain {
private static final Logger logger = LoggerFactory.getLogger(ServerMain.class);
private static final Logger logger = LoggerFactory.getLogger(ServerMain.class);
public static void main(String[] args) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
ServerMain.staticInitSystemProperty();
new SpringApplicationBuilder(ServerMain.class)
.logStartupInfo(false)
.run(args);
stopWatch.stop();
logger.info("kkFileView 服务启动完成,耗时:{}s演示页请访问: http://127.0.0.1:8012 ",stopWatch.getTotalTimeSeconds() );
}
private static void staticInitSystemProperty(){
//pdfbox兼容低版本jdk
System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider");
}
public static void main(String[] args) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
ConfigurableApplicationContext context = new SpringApplicationBuilder(ServerMain.class)
.logStartupInfo(false)
.run(args);
stopWatch.stop();
String port = context.getEnvironment().getProperty("server.port");
logger.info("kkFileView 服务启动完成,耗时:{}s演示页请访问: http://127.0.0.1:{} ", stopWatch.getTotalTimeSeconds(), port);
}
}

View File

@ -16,6 +16,11 @@ import java.util.Set;
@Component
public class ConfigConstants {
static {
//pdfbox兼容低版本jdk
System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider");
}
private static Boolean CACHE_ENABLED;
private static String[] SIM_TEXT = {};
private static String[] MEDIA = {};