Created
November 12, 2025 15:32
-
-
Save appleshan/1ee3fa4d6ab0724776760bc4b818112f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 父 pom 配置 | |
| <!-- 设置项目编码为 UTF-8 ,解决编译和运行时的中文乱码问题 --> | |
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
| <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |
| 子 pom 配置 | |
| <encoding>UTF-8</encoding> | |
| WebApplication.java | |
| // 设置系统默认编码为 UTF-8 ,解决容器环境中文乱码问题 | |
| // 必须在 Spring Boot 启动之前设置,确保日志输出使用正确的编码 | |
| System.setProperty("file.encoding", "UTF-8"); | |
| System.setProperty("sun.jnu.encoding", "UTF-8"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment