File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 93
93
spring.profiles.active=dev
94
94
[2]命令行设置属性启动,使用多环境配置文件:
95
95
命令行设置spring.profiles.active属性的值: java-jar xxx.jar--spring.profiles.active={profile}
96
+ 7.YAML语法:
97
+ [1]基本语法: k:(空格)v : 表示一对键值对(空格必须有);
98
+ (以空格的缩进来控制层级关系;只要是左对齐的一列数据,都是同一个层级的;属性和值也是大小写敏感)
99
+ [2]值的写法:
100
+ (1)字面量: 普通的值(数字,字符串,布尔)
101
+ k: v: 字面直接来写;字符串默认不用加上单引号或者双引号;
102
+ 1)值加双引号: 不会转义字符串里面的特殊字符;特殊字符会作为本身想表示的意思;
103
+ name: "zhangsan \n lisi": 输出 zhangsan 换行 lisi
104
+ 2)值加单引号: 会转义特殊字符,特殊字符最终只是一个普通的字符串数据;
105
+ name: 'zhangsan \n lisi':输出 zhangsan \n lisi
106
+ (2)对象、Map(属性和值)(键值对):
107
+ 1)多行写法:
108
+ friends:
109
+ lastName: zhangsan
110
+ age: 20
111
+ 2)行内写法:
112
+ friends: {lastName: zhangsan,age: 18}
113
+ (3)数组(List、Set):
114
+ 用"- 值"表示数组中的一个元素;
115
+ 1)多行写法:
116
+ pets:
117
+ ‐ cat
118
+ ‐ dog
119
+ ‐ pig
120
+ 2)行内写法:
121
+ pets: [cat,dog,pig]
96
122
```
You can’t perform that action at this time.
0 commit comments