org.yaml.snakeyaml.scanner.ScannerException:w。。。
org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key 报错解决⽅法
报错信息如下:
13:31:17.438 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.yaml.snakeyaml.scanner.ScannerException: while scanning a simple key
in 'reader', line 16, column 1:
jsonFile:
^
could not find expected ':'
in 'reader', line 17, column 5:
#encoding: "GBK"
^
at org.yaml.snakeyaml.scanner.ScannerImpl.stalePossibleSimpleKeys(ScannerImpl.java:484)
at org.yaml.snakeyaml.dMoreTokens(ScannerImpl.java:299)
at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:247)
at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(ParserImpl.java:602)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:165)
解决⽅法:
在l ⽂件键值之间要⽤冒号:隔开,⽽且冒号和值之间有⼀个空格,否则就报上⾯的错误!
错误写法:
encoding:true
正确写法:
encoding: true
⽽我呢是在开始的时候就给了个空格,导致报错。
错误展⽰:
spring怎么读取yaml正确展⽰:
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论