赞
踩
错误:
Caused by: org.yaml.snakeyaml.parser.ParserException: while parsing a block…
问题:yml文件格式错误
可以使用http://www.bejson.com/validators/yaml_editor/进行yml文件格式检测
我的结果总是显示缩进错误YAMLException: bad indentation of a mapping entry,比如:
spring:
datasource:
driverClassName: com.mysql.cj.jdbc.Driver
#url: jdbc:mysql://127.0.0.1:3306/XXX?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
url: jdbc:mysql://localhost:3307/XXX?useSSL=false&useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false
#url: jdbc:h2:file:./data/h2db
username : XXX
password : XXX
这是错误的,我把注释都删掉,并且把URL和username和password的缩进对齐,就不报错了。
也是很神奇。
正确格式:
spring:
datasource:
# driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3307/XXX?useSSL=false&useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false
# url : jdbc:h2:file:./data/h2db
username : XXX
password : XXX
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。