yaml是一种标记语言
yaml不是一种标记语言
它的文件后缀为yml
可以用来保存键值对、list、map、对象
语言格式为键: 值
他可以在springboot中为配置类实现批量注入
@Component @Data @ConfigurationProperties(prefix = "person") //这个注解实现与yaml文件关联 public class Person { private String name; private int age; private String birth; private List<String> friend; }
person:
name: shangyou
age: 3
birth: 19990404
friend:
- zhangsan
- lisi
- wangwu
创建对象可以直接调用