SpringBoot启动报错 YAMLException/MalformedInputException Input length = 1

本地测试SpringBoot,启动报错如下:

21:04:19.284 [restartedMain] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml'
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:545)
......
Caused by: org.yaml.snakeyaml.error.YAMLException: java.nio.charset.MalformedInputException: Input length = 1
......
Caused by: java.nio.charset.MalformedInputException: Input length = 1
	......

最后发现是application.yml文件的编码问题,从GBK改为UTF-8就好了。

原文地址:https://www.cnblogs.com/HeCG95/p/11808723.html