一、springboot中的三种配置文件格式,文件读取顺序按照:.properties --> .yml -->.yaml
二、三种文件的书写方法
1、properties
server.port=8080
server.address=127.0.0.1
对象写法
person.name=zhangsan
person.age=20
2、ymal/yml
- 数据值前面必须有空格,作为分隔符
- 使用空格缩进表示层级关系,相同缩进表示同一级
- 参数引用${key}
server:
port: 8080
address: 127.0.0.1
对象(map),键值对的集合
person:
name: zhangsan
age :20
person: {name: zhangsan,age: 20}
数组:一组按次序排列的值
address:
- beijing
- shanghai
address: [beijing,shanghai]
纯量:单个的,不可在分的值
masg1: 'hello \n world' #单引号会忽略转义字符
masg2: "heool \n world" #双引号不会忽略转义字符