springboot-yml内list、map组合写法

myProps:
  varmaplist:
      key11:
        - t1
        - t2
        - t3
      key22:
        - t11
        - t22
        - t33
  list:
    - topic1
    - topic2
    - topic3
  maps: {key1: 'value1', key2: 'value2'}




@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;
}
 

转载自https://www.cnblogs.com/neaos/p/10790528.html

原文地址:https://www.cnblogs.com/wenbuzhu/p/11968966.html