项目中有不同环境的yml配置文件,现在是需要从yml中读取配置的参数值。
拿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
配置文件中有两组配置