1、我们通过properties文件读取中文:server.port=8888person.last-name=帅哥

3、原因是在idea使用的utf-8,而properties文件使用的ascii码。点击File-Setting->File Encodings

5、更改这个配置完成之后,properties文件中的中文乱码了,需要重新修改。

6、重新编辑properties文件之后再次运行springboot测试类,这样中文读取就正常了。
时间:2024-11-01 11:04:23
1、我们通过properties文件读取中文:server.port=8888person.last-name=帅哥
3、原因是在idea使用的utf-8,而properties文件使用的ascii码。点击File-Setting->File Encodings
5、更改这个配置完成之后,properties文件中的中文乱码了,需要重新修改。
6、重新编辑properties文件之后再次运行springboot测试类,这样中文读取就正常了。