springboot-yml内list、map组合写法

yml:
myProps:
  varmaplist:
      key11:
        - t1
        - t2
        - t3
      key22:
        - t11
        - t22
        - t33
  list:
    - topic1
    - topic2
    - topic3
  maps: {key1: 'value1', key2: 'value2'}
MyProps:
@Component
@Data
@Configuration
@PropertySource(value = {"classpath:/bootstrap.yml"}, encoding = "utf-8")
@ConfigurationProperties(prefix = "myProps")
public class MyProps {

    private List<String> list;


    private Map<String,String> maps;

    private Map<String,List<String>> varmaplist;
}

 

作者: carjayal

来源: https://www.cnblogs.com/neaos/p/10790528.html

 

编辑注

{key1: 'value1', key2: 'value2'}

应该为:

{key1: "value1", key2: "value2"}


如果给你带来帮助,欢迎微信或支付宝扫一扫,赞一下。