承接:SpringBoot:yml文件给变量赋值以及test的使用
比如在yml中给student赋值:
student:
name: chen
age: 23
sex: true
hobbies: #hobbies是个数组,数组和list都用这种方法赋值,-后面要有空格
- book
- music
- run
location: {province: 贵州,city: 毕节,zone: 七星关区} #map类型的写法
skills: #skills是个list
- math
- codding
- running
pet:
name: hashiqi
color: white
现在假如在.properties中给student的name和age赋值,那么格式为:
student.name = 张三
student.age = 24
其他地方不必做更改