代码整理

This commit is contained in:
暮光:城中城
2018-12-08 14:59:26 +08:00
parent 67c584761d
commit 6465d3c412
80 changed files with 2043 additions and 882 deletions

View File

@@ -10,6 +10,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import java.net.InetAddress;
import java.util.Optional;
/**
* 程序启动器
@@ -27,11 +28,14 @@ public class Application extends SpringBootServletInitializer {
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext application = SpringApplication.run(Application.class, args);
Environment env = application.getEnvironment();
String contextPath = env.getProperty("server.servlet.context-path");
contextPath = Optional.ofNullable(contextPath).orElse("").replaceFirst("/", "");
contextPath = (contextPath.length() <= 0 || contextPath.endsWith("/")) ? contextPath : contextPath + "/";
logger.info("\n----------------------------------------------------------\n\t" +
"\t\t地址列表\n\t" +
"文档地址http://{}:{}/document.html\n" +
"文档地址http://{}:{}/{}document.html\n" +
"----------------------------------------------------------",
InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port")
InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port"), contextPath
);
}
}