feat: 添加UTF-8编码支持并优化DTO验证

refactor: 重构用户服务密码更新逻辑
fix: 删除不再使用的MarkdownDto类
style: 清理日志文件并优化日志配置
build: 更新pom.xml配置以支持UTF-8编码
docs: 更新application.properties配置文档
This commit is contained in:
qingfeng1121
2025-10-30 19:00:47 +08:00
parent 5803080352
commit f6d1d719a9
18 changed files with 2778 additions and 729 deletions

View File

@@ -61,7 +61,11 @@ logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
# 日志文件配置
logging.file.name=logs/web_project.log
logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
# 确保控制台输出使用UTF-8编码
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
# 日志编码配置 - 强制使用UTF-8
logging.charset.file=UTF-8
logging.charset.console=UTF-8
# Actuator配置 - 生产环境建议限制暴露的端点
management.endpoints.web.exposure.include=health,info,metrics,prometheus
management.endpoint.health.show-details=when_authorized
@@ -85,20 +89,41 @@ security.basic.enabled=false
security.ignored=/css/**,/js/**,/images/**,/favicon.ico
# 生产环境建议配置
# server.ssl.key-store=classpath:keystore.p12
# server.ssl.key-store-password=password
# server.ssl.key-store-type=PKCS12
# server.ssl.key-alias=tomcat
# 会话配置
server.servlet.session.timeout=30m
server.session.tracking-modes=cookie
# 国际化配置
spring.mvc.locale-resolver=fixed
spring.web.locale=zh_CN
#
## 响应编码配置
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
spring.messages.encoding=UTF-8
# 响应编码配置 - 确保所有响应使用UTF-8编码
server.servlet.encoding.charset=UTF-8
server.servlet.encoding.force=true
server.servlet.encoding.force-request=true
server.servlet.encoding.force-response=true
server.servlet.encoding.enabled=true
# 配置控制台输出编码 - 通过日志系统配置确保中文显示正常
# logging.pattern.console=%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{faint} %clr{%5p} %clr{${PID}}{magenta} %clr{---}{faint} %clr{[%15.15t]}{faint} %clr{%-40.40logger{39}}{cyan} %clr{:}{faint} %m%n%wEx
# 配置Maven启动JVM参数需在启动时通过命令行指定或在pom.xml中配置
# 实际使用时请在启动命令中添加:-Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8
# 更详细的日志配置 - 确保所有日志输出正确编码
# logging.level.root=INFO
# logging.level.org.springframework.web=DEBUG
# logging.level.org.springframework.security=INFO
# logging.level.com.qf.myafterprojecy=DEBUG
# 确保数据库连接编码正确
spring.datasource.hikari.data-source-properties.useUnicode=true
spring.datasource.hikari.data-source-properties.serverTimezone=Asia/Shanghai
spring.datasource.hikari.data-source-properties.characterEncoding=utf-8
# 应用性能优化配置
spring.main.allow-bean-definition-overriding=true
spring.main.lazy-initialization=false
# API 文档配置
spring.mvc.pathmatch.matching-strategy=ant_path_matcher