问题描述 在application.properties中配置了自定义属性,然后在代码中引用,发现是乱码: 解决方案 先在配置文件中加固定编码方式 spring.http.encoding.force=true spring.http.encoding.charset=UTF-8 spring.http.encoding.enabled=true server.tomcat.uri-encoding=UTF-8 然后在idea中打开设置,输入file encoding将圈出部分做如图修改 如果没效果建议重新编译工程,然后重启一下idea就行了