2025-12-18 15:13:23 +08:00
|
|
|
|
package com.mtkj.mtpay;
|
|
|
|
|
|
|
2025-12-19 16:52:28 +08:00
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2025-12-18 15:13:23 +08:00
|
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
2025-12-19 16:52:28 +08:00
|
|
|
|
import org.springframework.core.env.Environment;
|
2025-12-18 15:13:23 +08:00
|
|
|
|
|
2025-12-19 16:52:28 +08:00
|
|
|
|
@Slf4j
|
2025-12-18 15:13:23 +08:00
|
|
|
|
@SpringBootApplication
|
|
|
|
|
|
public class MtPayApplication {
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
2025-12-19 16:52:28 +08:00
|
|
|
|
try {
|
|
|
|
|
|
SpringApplication app = new SpringApplication(MtPayApplication.class);
|
|
|
|
|
|
Environment env = app.run(args).getEnvironment();
|
|
|
|
|
|
|
|
|
|
|
|
String applicationName = env.getProperty("spring.application.name", "mt-pay");
|
|
|
|
|
|
String serverPort = env.getProperty("server.port", "8080");
|
|
|
|
|
|
String contextPath = env.getProperty("server.servlet.context-path", "");
|
|
|
|
|
|
String activeProfiles = String.join(",", env.getActiveProfiles());
|
|
|
|
|
|
|
|
|
|
|
|
log.info("""
|
|
|
|
|
|
|
|
|
|
|
|
========================================
|
|
|
|
|
|
应用启动成功!
|
|
|
|
|
|
========================================
|
|
|
|
|
|
应用名称: {}
|
|
|
|
|
|
运行环境: {}
|
|
|
|
|
|
访问地址: http://localhost:{}{}
|
|
|
|
|
|
========================================
|
|
|
|
|
|
""",
|
|
|
|
|
|
applicationName,
|
|
|
|
|
|
activeProfiles.isEmpty() ? "default" : activeProfiles,
|
|
|
|
|
|
serverPort,
|
|
|
|
|
|
contextPath);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
log.error("应用启动失败", e);
|
|
|
|
|
|
throw e;
|
|
|
|
|
|
}
|
2025-12-18 15:13:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|