springboot讀取properties文件出現中文亂碼


springboot讀取properties文件出現中文亂碼

使用idea編寫springboot時讀取application.properties配置文件,讀取的內容在控制台打印,出現了中文亂碼問題

解決方案:idea -> file -> settings -> Editor -> File Encodings

設置Properties Files (*. properties)下的Default encoding for properties files:為utf-8,並勾選Transparent native-to-asci conversion,保存退出。如下圖所示:

修改后,發現原配置文件的中文出現了亂碼,如下圖所示:

刪除其中的中文字符,重新寫上中文即可。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM