Files
MTKJPAY/mt-pay/src/main/java/com/mtkj/mtpay/MtPayApplication.java
qiube 504ccabba1 docs(config): 添加配置文件管理说明并调整开发环境配置
- 创建 CONFIG_MANAGEMENT.md 详细说明配置文件结构和管理规范
- 为 mt-pay 和 mt-startup 模块分别创建生产环境配置文件
- 将前端访问地址从生产域名改为开发环境本地地址
- 更新 PayPal Webhook 配置为开发环境内网穿透地址
- 调整应用启动时的访问地址提示信息
- 优化数据库连接和服务器配置的环境变量支持
2025-12-26 16:05:53 +08:00

96 lines
6.0 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.mtkj.mtpay;
import com.mtkj.mtpay.config.BaiduTranslatorConfig;
import com.mtkj.mtpay.config.PingPongProperties;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.core.env.Environment;
@Slf4j
@SpringBootApplication
@EnableConfigurationProperties({PingPongProperties.class, BaiduTranslatorConfig.class})
public class MtPayApplication {
public static void main(String[] args) {
try {
log.info("""
╔══════════════════════════════════════════════════════════╗
║ ║
║ MTKJ PAY 支付系统正在启动... ║
║ ║
╚══════════════════════════════════════════════════════════╝
""");
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", "8082");
String contextPath = env.getProperty("server.servlet.context-path", "");
String activeProfiles = String.join(",", env.getActiveProfiles());
// 构建完整的访问地址开发环境使用localhost生产环境使用配置的域名
String serverHost = env.getProperty("app.server.host", "localhost");
String protocol = env.getProperty("app.server.protocol", "http");
String baseUrl = protocol + "://" + serverHost + ":" + serverPort + contextPath;
String apiUrl = baseUrl + "/api";
String druidUrl = baseUrl + "/druid";
// 打印醒目的启动成功标识
log.info("""
╔══════════════════════════════════════════════════════════╗
║ ║
║ ✅ MTKJ PAY 支付系统启动成功! ✅ ║
║ ║
╠══════════════════════════════════════════════════════════╣
║ 应用信息 ║
╠══════════════════════════════════════════════════════════╣
║ 应用名称: {:<45} ║
║ 运行环境: {:<45} ║
║ 服务端口: {:<45} ║
╠══════════════════════════════════════════════════════════╣
║ 访问地址 ║
╠══════════════════════════════════════════════════════════╣
║ 后端服务: {:<45} ║
║ API接口: {:<45} ║
║ Druid监控: {:<45} ║
╠══════════════════════════════════════════════════════════╣
║ 状态: 🟢 服务运行中,可以接收请求 ║
╚══════════════════════════════════════════════════════════╝
""",
applicationName,
activeProfiles.isEmpty() ? "default" : activeProfiles,
serverPort,
baseUrl,
apiUrl,
druidUrl);
// 额外提示信息
log.info("""
📌 提示:
- 前端代理地址: http://localhost:3000
- 后端API地址: {}
- 图片上传接口: {}/product/upload/image
- 商品管理接口: {}/product
""", apiUrl, apiUrl, apiUrl);
} catch (Exception e) {
log.error("""
╔══════════════════════════════════════════════════════════╗
║ ║
║ ❌ MTKJ PAY 支付系统启动失败! ❌ ║
║ ║
╚══════════════════════════════════════════════════════════╝
""", e);
throw e;
}
}
}