Spring Boot常见报错1-while parsing a block mapping
一、控制台显示23:20:58.580 [restartedMain] ERROR org.springframework.boot.SpringApplication - Application run failedorg.yaml.snakeyaml.parser.ParserException: while parsing a block mappingin ‘reader’, line 4
一、控制台显示
23:20:58.580 [restartedMain] ERROR org.springframework.boot.SpringApplication - Application run failed
org.yaml.snakeyaml.parser.ParserException: while parsing a block mapping
in ‘reader’, line 4, column 3:
profiles:
expected , but found ‘’
in ‘reader’, line 8, column 5:
thymeleaf:
二、原因
yml文件格式异常
三、错误代码
server:
port: 8080
spring:
profiles:
# 外置jdbc、redis和mail配置文件
active: jdbc,redis,mail
# 关闭thymeleaf页面缓存
thymeleaf:
cache:false
# 配置国际化资源文件
messages:
basename: i18n.logo
# MyBatis配置
mybatis:
configuration:
#开启驼峰命名匹配映射
map-underscore-to-camel-case: true
#配置MyBatis的xml映射文件路径
mapper-locations: classpath:mapper/*.xml
#配置XML映射文件中指定的实体类别名路径
type-aliases-package: com.itheima.model.domain
#pagehelper分页设置
pagehelper:
helper-dialect: mysql
reasonable: true
support-methods-arguments: true
params: count=countSql
#浏览器cookie相关设置
COOKIE:
# 设置cookie默认时长为30分钟
VALIDITY: 1800
四、修改
五、总结
yml文件非常严格!!!
1.冒号后面必须留个空格,否则格式错误
2.特别注意前面空格又没有增加或者减少,有没有对齐
引用
application.yml 注意事项
https://www.cnblogs.com/zs-notes/p/9366526.html
* 在application.yml 文件书写注意:
1. 不同“等级” 用冒号隔开
2. 次等级的前面是空格,不能使用制表符(tab)
3. 冒号之后如果有值,那么冒号和值之间至少有一个空格,不能紧贴着*
更多推荐
所有评论(0)