2018-01-17 14:10:40 +08:00
|
|
|
|
package cn.keking;
|
|
|
|
|
|
2022-12-16 23:58:56 +08:00
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2021-02-04 11:33:56 +08:00
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
2018-01-17 14:10:40 +08:00
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
2021-02-08 15:16:24 +08:00
|
|
|
|
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
2021-02-04 11:33:56 +08:00
|
|
|
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
2021-02-04 11:38:45 +08:00
|
|
|
|
import org.springframework.context.ConfigurableApplicationContext;
|
2018-01-17 14:10:40 +08:00
|
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
2021-02-04 11:33:56 +08:00
|
|
|
|
import org.springframework.util.StopWatch;
|
2018-01-17 14:10:40 +08:00
|
|
|
|
|
|
|
|
|
@SpringBootApplication
|
|
|
|
|
@EnableScheduling
|
|
|
|
|
@ComponentScan(value = "cn.keking.*")
|
2020-12-26 17:30:24 +08:00
|
|
|
|
public class ServerMain {
|
2020-12-26 02:10:50 +08:00
|
|
|
|
|
2021-02-04 11:38:45 +08:00
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(ServerMain.class);
|
2021-02-04 11:33:56 +08:00
|
|
|
|
|
2021-02-04 11:38:45 +08:00
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
StopWatch stopWatch = new StopWatch();
|
|
|
|
|
stopWatch.start();
|
|
|
|
|
ConfigurableApplicationContext context = new SpringApplicationBuilder(ServerMain.class)
|
|
|
|
|
.logStartupInfo(false)
|
|
|
|
|
.run(args);
|
|
|
|
|
stopWatch.stop();
|
2022-12-16 23:58:56 +08:00
|
|
|
|
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);
|
2021-02-04 11:38:45 +08:00
|
|
|
|
}
|
2021-02-04 11:33:56 +08:00
|
|
|
|
|
2018-01-17 14:10:40 +08:00
|
|
|
|
}
|