Mrli
别装作很努力,
因为结局不会陪你演戏。
Contacts:
QQ博客园

yaml基础语法_spring_boot

2019/09/15 计算机基础知识
Word count: 229 | Reading time: 1min

yaml基础语法_spring_boot

yaml aren’t markup language 即yaml不是标语语言:

xml(标记语言):

1
2
3
4
> <server>
> <port>8888</port>
> </server>
>

java spring boot默认全局配置文件:

  1. application.properties 使用的时 key=value

  2. application.yaml:

    • k:v

    • 通过缩进,垂直对齐指定层次关系

      • 字符串可以默认不写引号,写引号中的转义符会被翻译:e.g."天\n津"
    • 1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      20
      21
      22
      server:
      port: 8888
      student:
      name: 张三
      age: 18
      birthday: 2019/07/19
      location: # <==> {province: 陕西, city: 西安} 行内写法
      province: 陕西
      city: 西安
      # 对应java里的字典map
      hobbies: # <==> [足球,篮球]
      - 足球
      - 篮球
      # 对应java里的列表List
      skills: # <==>[编程,金融]
      - 编程
      - 金融
      # 对应java里的集合set
      pet: # <==>{name: wc, type: hsq}
      name: wc
      type: hsq
      # entity的另一个类pet.java
    • [Set,List,数组\Array]、{Map、对象类型的属性StudentPet},[]可以省略,{}不可以省略

Author: Mrli

Link: https://nymrli.top/2019/07/07/yaml基础语法-spring-boot/

Copyright: All articles in this blog are licensed under CC BY-NC-SA 3.0 unless stating additionally.

< PreviousPost
staticmethod和classmethod区别
NextPost >
Python类的继承-super()使用
CATALOG
  1. 1. yaml基础语法_spring_boot