随笔记录
本次记录下使用springboot的启动页打印初始化启动ip和端口
public class ApiApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
System.setProperty("nacos.logging.default.config.enabled", "false");
Environment env = SpringApplication.run(ApiApplication.class, args).getEnvironment();
String port = env.getProperty("server.port", "8090");
String actPort = env.getProperty("management.server.port", "8091");
try {
log.info("Access URLs:\n----------------------------------------------------------\n\t"
+ "Local: \t\thttp://127.0.0.1:{}\n\t"
+ "External: \thttp://{}:{}\n\t"
+ "health: \thttp://{}:{}/act/health\n----------------------------------------------------------",
port,
InetAddress.getLocalHost().getHostAddress(),
port,
InetAddress.getLocalHost().getHostAddress(),
actPort
);
}catch (Exception e){
e.printStackTrace();
}
}
}