亂碼是因爲服務器沒有安裝字體導致的
1、查看中文字體
fc-list :lang=zh
2、安裝字體
yum -y install fontconfig #安裝字體庫
yum -y install ttmkfdir mkfontscale #安裝字體索引信息
可拷貝Windows的字體目錄:C:\Windows\Fonts
如果你代碼裏寫的是宋體,可以直接下載我的資源 字體下載
3、linux字體目錄:/usr/share/fonts,建議創建一個目錄mkdir chinese 放中文字體
4、把字體上傳到/usr/share/fonts/chinese目錄
5、然後在/usr/share/fonts/chinese執行命令,生成字庫索引信息
mkfontscale
mkfontdir
6、更新字體緩存
fc-cache
fc-cache -fv
source /etc/profile
. /etc/profile
使用fc-list :lang=zh查看安裝的中文字體
重啓springboot工作流,搞定.