From d01dddf9e32724bbf4a720949c94dc19675d3035 Mon Sep 17 00:00:00 2001 From: kl Date: Thu, 4 Feb 2021 11:38:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E8=8E=B7=E5=8F=96=E6=BC=94?= =?UTF-8?q?=E7=A4=BA=E9=A1=B5=E8=AE=BF=E9=97=AE=E5=9C=B0=E5=9D=80=E7=9A=84?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/keking/ServerMain.java | 29 ++++++++----------- .../cn/keking/config/ConfigConstants.java | 5 ++++ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/server/src/main/java/cn/keking/ServerMain.java b/server/src/main/java/cn/keking/ServerMain.java index fbaa00a5..e178856f 100644 --- a/server/src/main/java/cn/keking/ServerMain.java +++ b/server/src/main/java/cn/keking/ServerMain.java @@ -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); + } } diff --git a/server/src/main/java/cn/keking/config/ConfigConstants.java b/server/src/main/java/cn/keking/config/ConfigConstants.java index e393ac64..c069814a 100644 --- a/server/src/main/java/cn/keking/config/ConfigConstants.java +++ b/server/src/main/java/cn/keking/config/ConfigConstants.java @@ -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 = {};