从位置'classpath:/application.yml'加载属性源失败
一般是yml里面文件编码的问题或者格式错误,
1、首先查看报错下方有没有标记yml语法错误 例如:
in 'reader' ,34,9
use-forward-headers: true
我这是少了空格,
2、设置编码 文件->设置->编辑器->文件编码,File-->Settings-->File Encodings
设置编码utf8
或者点击下方设置成utf8[图片上传中...(E245BFE4-9CEB-464b-8C78-6BA061BE8980.png-173c57-1615953230220-0)]
设置idea解析编码utf8
3、如果还不行删除yml的中文注释
4、如果还还还不行,pom加上下面依赖
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.23</version>
</dependency>