解决Caused by: java.nio.charset.MalformedInputException: Input length = 1

本文探讨了Spring Boot应用中遇到的YAML配置文件读取异常问题,具体表现为使用了错误的编码格式导致的字符解析错误。文章提供了两种解决方案:移除文件中的中文注释或更改IDEA中的文件编码设置。
  • application.yml文件如下:
    在这里插入图片描述
  • 错误信息如下:
java.lang.IllegalStateException: Failed to load property source from 'file:/F:/java/SpringCloud/provider-service/target/classes/application.yml' (classpath:/application.yml)
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:564) ~[spring-boot-2.3.9.RELEASE.jar:2.3.9.RELEASE]
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadForFileExtension(ConfigFileApplicationListener.java:501) ~[spring-boot-2.3.9.RELEASE.jar:2.3.9.RELEASE]
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:471) ~[spring-boot-2.3.9.RELEASE.jar:2.3.9.RELEASE]
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$null$7(ConfigFileApplicationListener.java:450) ~[spring-boot-2.3.9.RELEASE.jar:2.3.9.RELEASE]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_271]
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$load$8(ConfigFileApplicationListener.java:450) ~[spring-boot-2.3.9.RELEASE.jar:2.3.9.RELEASE]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_271]
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:447) ~[spring-boot-2.3.9.RELEASE.jar:2.3.9.RELEASE]
	at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$load$0(ConfigFileApplicationListener.java:350) ~[spring-boot-2.3.9.RELEASE.jar:2.3.9.RELEASE]
	at org.springframework.boot.context.config.FilteredPropertySource.apply(FilteredPropertySource.java:54) 
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值