springboot yml文件中的各类型数据配置举例

项目中有不同环境的yml配置文件,现在是需要从yml中读取配置的参数值。

 

springboot yml文件中的各类型数据配置举例_第1张图片

 

 拿application-dev.yml举例,文件中配置如下

#1. 常用字符串配置
upload:
  path: /Users/tempfile/background/

#2. list或array  值用逗号拼接
gateway:
  url: http://xxx.com/conf/gateway,http://xxx.com/conf/gateway2

#3. map对象 键值对形式存储
server:
  #(1) map的值为List类型数据
  stringListMap:
    A: http://localhost:9996/upload/2,http://localhost:9996/upload/1
    B: http://localhost:9996/upload/3,http://localhost:9996/upload/4

  #(2) map的值为String类型数据
  stringMap:
    http://localhost:9996/upload/2,http://localhost:9996/upload/1
    

配置文件中有两组配置

 

你可能感兴趣的:(bootstrap)