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:
@@ -5,12 +5,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>4.0.0</version>
|
<version>3.2.0</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.mtkj</groupId>
|
<groupId>com.mtkj</groupId>
|
||||||
<artifactId>mt-pay</artifactId>
|
<artifactId>mt-pay</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<name>mt-pay</name>
|
<name>mt-pay</name>
|
||||||
<description>mt-pay</description>
|
<description>mt-pay</description>
|
||||||
<url/>
|
<url/>
|
||||||
@@ -30,26 +31,27 @@
|
|||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!-- Spring Boot Web -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-restclient</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Boot DevTools -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MySQL 驱动 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.mysql</groupId>
|
<groupId>com.mysql</groupId>
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- MyBatis-Plus -->
|
<!-- MyBatis-Plus -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
@@ -63,29 +65,31 @@
|
|||||||
<artifactId>aliyun-sdk-oss</artifactId>
|
<artifactId>aliyun-sdk-oss</artifactId>
|
||||||
<version>3.17.4</version>
|
<version>3.17.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Druid数据源 -->
|
<!-- Druid数据源 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>druid-spring-boot-3-starter</artifactId>
|
<artifactId>druid-spring-boot-3-starter</artifactId>
|
||||||
<version>1.2.20</version>
|
<version>1.2.20</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Boot Validation -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-validation</artifactId>
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Lombok -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Boot Test -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-restclient-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
@@ -100,6 +104,7 @@
|
|||||||
<path>
|
<path>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
</path>
|
</path>
|
||||||
</annotationProcessorPaths>
|
</annotationProcessorPaths>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -116,6 +121,13 @@
|
|||||||
</excludes>
|
</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|||||||
@@ -11,30 +11,77 @@ public class MtPayApplication {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
try {
|
try {
|
||||||
|
log.info("""
|
||||||
|
|
||||||
|
╔══════════════════════════════════════════════════════════╗
|
||||||
|
║ ║
|
||||||
|
║ MTKJ PAY 支付系统正在启动... ║
|
||||||
|
║ ║
|
||||||
|
╚══════════════════════════════════════════════════════════╝
|
||||||
|
""");
|
||||||
|
|
||||||
SpringApplication app = new SpringApplication(MtPayApplication.class);
|
SpringApplication app = new SpringApplication(MtPayApplication.class);
|
||||||
Environment env = app.run(args).getEnvironment();
|
Environment env = app.run(args).getEnvironment();
|
||||||
|
|
||||||
String applicationName = env.getProperty("spring.application.name", "mt-pay");
|
String applicationName = env.getProperty("spring.application.name", "mt-pay");
|
||||||
String serverPort = env.getProperty("server.port", "8080");
|
String serverPort = env.getProperty("server.port", "8082");
|
||||||
String contextPath = env.getProperty("server.servlet.context-path", "");
|
String contextPath = env.getProperty("server.servlet.context-path", "");
|
||||||
String activeProfiles = String.join(",", env.getActiveProfiles());
|
String activeProfiles = String.join(",", env.getActiveProfiles());
|
||||||
|
|
||||||
|
// 构建完整的访问地址
|
||||||
|
String baseUrl = "http://localhost:" + serverPort + contextPath;
|
||||||
|
String apiUrl = baseUrl + "/api";
|
||||||
|
String druidUrl = baseUrl + "/druid";
|
||||||
|
|
||||||
|
// 打印醒目的启动成功标识
|
||||||
log.info("""
|
log.info("""
|
||||||
|
|
||||||
========================================
|
╔══════════════════════════════════════════════════════════╗
|
||||||
应用启动成功!
|
║ ║
|
||||||
========================================
|
║ ✅ MTKJ PAY 支付系统启动成功! ✅ ║
|
||||||
应用名称: {}
|
║ ║
|
||||||
运行环境: {}
|
╠══════════════════════════════════════════════════════════╣
|
||||||
访问地址: http://localhost:{}{}
|
║ 应用信息 ║
|
||||||
========================================
|
╠══════════════════════════════════════════════════════════╣
|
||||||
|
║ 应用名称: {:<45} ║
|
||||||
|
║ 运行环境: {:<45} ║
|
||||||
|
║ 服务端口: {:<45} ║
|
||||||
|
╠══════════════════════════════════════════════════════════╣
|
||||||
|
║ 访问地址 ║
|
||||||
|
╠══════════════════════════════════════════════════════════╣
|
||||||
|
║ 后端服务: {:<45} ║
|
||||||
|
║ API接口: {:<45} ║
|
||||||
|
║ Druid监控: {:<45} ║
|
||||||
|
╠══════════════════════════════════════════════════════════╣
|
||||||
|
║ 状态: 🟢 服务运行中,可以接收请求 ║
|
||||||
|
╚══════════════════════════════════════════════════════════╝
|
||||||
""",
|
""",
|
||||||
applicationName,
|
applicationName,
|
||||||
activeProfiles.isEmpty() ? "default" : activeProfiles,
|
activeProfiles.isEmpty() ? "default" : activeProfiles,
|
||||||
serverPort,
|
serverPort,
|
||||||
contextPath);
|
baseUrl,
|
||||||
|
apiUrl,
|
||||||
|
druidUrl);
|
||||||
|
|
||||||
|
// 额外提示信息
|
||||||
|
log.info("""
|
||||||
|
|
||||||
|
📌 提示:
|
||||||
|
- 前端代理地址: http://localhost:3000
|
||||||
|
- 后端API地址: {}
|
||||||
|
- 图片上传接口: {}/product/upload/image
|
||||||
|
- 商品管理接口: {}/product
|
||||||
|
""", apiUrl, apiUrl, apiUrl);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("应用启动失败", e);
|
log.error("""
|
||||||
|
|
||||||
|
╔══════════════════════════════════════════════════════════╗
|
||||||
|
║ ║
|
||||||
|
║ ❌ MTKJ PAY 支付系统启动失败! ❌ ║
|
||||||
|
║ ║
|
||||||
|
╚══════════════════════════════════════════════════════════╝
|
||||||
|
""", e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,11 +30,16 @@ public class CreateProductRequestDTO implements Serializable {
|
|||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主图URL
|
* 主图URL(单个URL,兼容旧版本)
|
||||||
*/
|
*/
|
||||||
@Size(max = 4000, message = "主图URL长度不能超过4000")
|
@Size(max = 4000, message = "主图URL长度不能超过4000")
|
||||||
private String mainImage;
|
private String mainImage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主图URL列表(支持多张主图,JSON格式存储)
|
||||||
|
*/
|
||||||
|
private List<String> mainImages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品状态:ACTIVE-上架,INACTIVE-下架
|
* 商品状态:ACTIVE-上架,INACTIVE-下架
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -42,8 +42,9 @@ public class GlobalExceptionHandler {
|
|||||||
});
|
});
|
||||||
|
|
||||||
log.warn("参数验证失败: {}", errors);
|
log.warn("参数验证失败: {}", errors);
|
||||||
return ResponseEntity.badRequest()
|
Result<Map<String, String>> result = Result.fail(ResultCode.VALIDATION_ERROR.getCode(), ResultCode.VALIDATION_ERROR.getMessage());
|
||||||
.body(Result.fail(ResultCode.VALIDATION_ERROR.getCode(), ResultCode.VALIDATION_ERROR.getMessage(), errors));
|
result.setData(errors);
|
||||||
|
return ResponseEntity.badRequest().body(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.mtkj.mtpay.mapper;
|
package com.mtkj.mtpay.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.mtkj.mtpay.entity.PaymentOrder;
|
import com.mtkj.mtpay.entity.PaymentOrder;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@@ -16,10 +17,9 @@ public interface PaymentOrderMapper extends BaseMapper<PaymentOrder> {
|
|||||||
* 根据商户订单号查询
|
* 根据商户订单号查询
|
||||||
*/
|
*/
|
||||||
default Optional<PaymentOrder> findByMerchantTransactionId(String merchantTransactionId) {
|
default Optional<PaymentOrder> findByMerchantTransactionId(String merchantTransactionId) {
|
||||||
PaymentOrder order = selectOne(
|
LambdaQueryWrapper<PaymentOrder> wrapper = new LambdaQueryWrapper<>();
|
||||||
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper.<PaymentOrder>lambdaQuery()
|
wrapper.eq(PaymentOrder::getMerchantTransactionId, merchantTransactionId);
|
||||||
.eq(PaymentOrder::getMerchantTransactionId, merchantTransactionId)
|
PaymentOrder order = selectOne(wrapper);
|
||||||
);
|
|
||||||
return Optional.ofNullable(order);
|
return Optional.ofNullable(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,10 +27,9 @@ public interface PaymentOrderMapper extends BaseMapper<PaymentOrder> {
|
|||||||
* 根据PingPong交易流水号查询
|
* 根据PingPong交易流水号查询
|
||||||
*/
|
*/
|
||||||
default Optional<PaymentOrder> findByTransactionId(String transactionId) {
|
default Optional<PaymentOrder> findByTransactionId(String transactionId) {
|
||||||
PaymentOrder order = selectOne(
|
LambdaQueryWrapper<PaymentOrder> wrapper = new LambdaQueryWrapper<>();
|
||||||
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper.<PaymentOrder>lambdaQuery()
|
wrapper.eq(PaymentOrder::getTransactionId, transactionId);
|
||||||
.eq(PaymentOrder::getTransactionId, transactionId)
|
PaymentOrder order = selectOne(wrapper);
|
||||||
);
|
|
||||||
return Optional.ofNullable(order);
|
return Optional.ofNullable(order);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.aliyun.oss.OSS;
|
|||||||
import com.aliyun.oss.OSSClientBuilder;
|
import com.aliyun.oss.OSSClientBuilder;
|
||||||
import com.aliyun.oss.common.auth.CredentialsProvider;
|
import com.aliyun.oss.common.auth.CredentialsProvider;
|
||||||
import com.aliyun.oss.common.auth.CredentialsProviderFactory;
|
import com.aliyun.oss.common.auth.CredentialsProviderFactory;
|
||||||
import com.aliyun.oss.exception.OSSException;
|
import com.aliyun.oss.OSSException;
|
||||||
import com.mtkj.mtpay.config.AliyunOSSProperties;
|
import com.mtkj.mtpay.config.AliyunOSSProperties;
|
||||||
import com.mtkj.mtpay.service.OssService;
|
import com.mtkj.mtpay.service.OssService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ pingpong:
|
|||||||
|
|
||||||
# 服务器配置
|
# 服务器配置
|
||||||
server:
|
server:
|
||||||
port: 8080
|
port: 8082
|
||||||
servlet:
|
servlet:
|
||||||
context-path: /
|
context-path: /
|
||||||
# 文件上传配置
|
# 文件上传配置
|
||||||
@@ -83,6 +83,12 @@ server:
|
|||||||
# 文件写入磁盘的阈值(超过此大小会写入临时文件)
|
# 文件写入磁盘的阈值(超过此大小会写入临时文件)
|
||||||
file-size-threshold: 2MB
|
file-size-threshold: 2MB
|
||||||
|
|
||||||
|
# 应用配置
|
||||||
|
app:
|
||||||
|
# 前端访问地址(用于生成商品详情页URL等)
|
||||||
|
frontend:
|
||||||
|
url: http://localhost:3000
|
||||||
|
|
||||||
# 阿里云OSS相关配置
|
# 阿里云OSS相关配置
|
||||||
aliyun:
|
aliyun:
|
||||||
oss:
|
oss:
|
||||||
|
|||||||
@@ -100,7 +100,7 @@
|
|||||||
</springProfile>
|
</springProfile>
|
||||||
|
|
||||||
<!-- 默认配置 -->
|
<!-- 默认配置 -->
|
||||||
<springProfile name="!dev & !test & !prod">
|
<springProfile name="!dev & !test & !prod">
|
||||||
<root level="INFO">
|
<root level="INFO">
|
||||||
<appender-ref ref="CONSOLE"/>
|
<appender-ref ref="CONSOLE"/>
|
||||||
<appender-ref ref="ASYNC_FILE"/>
|
<appender-ref ref="ASYNC_FILE"/>
|
||||||
|
|||||||
25
pom.xml
25
pom.xml
@@ -5,12 +5,13 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>4.0.0</version>
|
<version>3.2.0</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.mtkj</groupId>
|
<groupId>com.mtkj</groupId>
|
||||||
<artifactId>MTKJPAY</artifactId>
|
<artifactId>MTKJPAY</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<name>MTKJPAY</name>
|
<name>MTKJPAY</name>
|
||||||
<description>MTKJPAY</description>
|
<description>MTKJPAY</description>
|
||||||
<url/>
|
<url/>
|
||||||
@@ -30,36 +31,33 @@
|
|||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!-- 引入 mt-pay 模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>com.mtkj</groupId>
|
||||||
<artifactId>spring-boot-starter-restclient</artifactId>
|
<artifactId>mt-pay</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Boot Web -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Boot DevTools -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-devtools</artifactId>
|
<artifactId>spring-boot-devtools</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.mysql</groupId>
|
<!-- Lombok -->
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-restclient-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@@ -72,6 +70,7 @@
|
|||||||
<path>
|
<path>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>${lombok.version}</version>
|
||||||
</path>
|
</path>
|
||||||
</annotationProcessorPaths>
|
</annotationProcessorPaths>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -1,13 +1,93 @@
|
|||||||
package com.mtkj.mtkjpay;
|
package com.mtkj.mtkjpay;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
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 class MtkjpayApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
spring.application.name=MTKJPAY
|
spring.application.name=MTKJPAY
|
||||||
server.port=8080
|
server.port=8082
|
||||||
spring.profiles.active=dev
|
spring.profiles.active=dev
|
||||||
|
|||||||
Reference in New Issue
Block a user