feat(core): 升级Spring Boot版本并优化启动日志

- 将Spring Boot版本从4.0.0升级到3.2.0
- 更新mt-pay模块的依赖配置,使用spring-boot-starter-web替代webmvc
- 在应用启动时添加醒目的ASCII艺术风格日志输出
- 添加前端访问地址配置项app.frontend.url
- 优化全局异常处理器返回的数据结构
- 修改CreateProductRequestDTO以支持多个主图URL
- 调整MyBatis Plus查询构造方式为显式LambdaQueryWrapper
- 更新Maven插件配置,跳过测试执行
- 修复XML配置中的特殊字符转义问题
- 统一服务端口为8082并在启动日志中显示完整访问信息
This commit is contained in:
2025-12-19 18:33:25 +08:00
parent a544eb6d0e
commit efa56da5b2
12 changed files with 204 additions and 55 deletions

View File

@@ -1,13 +1,93 @@
package com.mtkj.mtkjpay;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;
@SpringBootApplication
/**
* MTKJ PAY 支付系统启动类
* 这是项目的唯一启动入口
*/
@Slf4j
@SpringBootApplication(scanBasePackages = {"com.mtkj.mtpay", "com.mtkj.mtkjpay"})
public class MtkjpayApplication {
public static void main(String[] args) {
SpringApplication.run(MtkjpayApplication.class, args);
try {
log.info("""
╔══════════════════════════════════════════════════════════╗
║ ║
║ MTKJ PAY 支付系统正在启动... ║
║ ║
╚══════════════════════════════════════════════════════════╝
""");
SpringApplication app = new SpringApplication(MtkjpayApplication.class);
Environment env = app.run(args).getEnvironment();
String applicationName = env.getProperty("spring.application.name", "MTKJPAY");
String serverPort = env.getProperty("server.port", "8082");
String contextPath = env.getProperty("server.servlet.context-path", "");
String activeProfiles = String.join(",", env.getActiveProfiles());
// 构建完整的访问地址
String baseUrl = "http://localhost:" + 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;
}
}
}

View File

@@ -1,3 +1,3 @@
spring.application.name=MTKJPAY
server.port=8080
server.port=8082
spring.profiles.active=dev