springboot细节回顾
Posted 天叔
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了springboot细节回顾相关的知识,希望对你有一定的参考价值。
配置文件模块
.properties:目前官方不推荐,建议更换为yaml
语法结构: key=value
.yaml:YamlPropertiesFactoryBean
将yaml加载为Properties,
YamlMapFactoryBean
将yaml加载为Map,对空格要求极为严格
语法结构:key:空格+value
##yaml
# 普通的key-value
name: tian
# 对象
student:
name: tian
age: 5
#行内写法
student: name: tian,age: 5
# 数组
pets:
- cat
- dog
- pig
pets: [cat,dog,pig]
##.properties 只能保存键值对
name=tian
student.name = tian
student.age = 5
以上是关于springboot细节回顾的主要内容,如果未能解决你的问题,请参考以下文章