Solve the problem of Chinese garbled characters when SpringBoot reads the .properties configuration file

In the process of working on the project, if the value of the custom attribute in the .properties file is Chinese, the browser may read garbled data in the configuration file:

server.port=8082

server.servlet.context-path=/myboot

school.name=理工大学
school.address=红光大道69号
school.age=81

Open the browser and visit localhost:8082/myboot/ and the following error occurs:

This is because the default encoding format of the .properties file is not utf-8. Open the settings and make the following settings:

Note: Revisit after setting, if the characters are still garbled, be sure to re-enter the Chinese in the configuration file! ! !

ps: (The content I re-entered needs to be slightly different from the original content before it can be displayed correctly, and it will be changed after running it again. It is probably a small bug in the springboot framework)

Guess you like

Origin blog.csdn.net/m0_57545353/article/details/123266298