【问题标题】:define list of map in application.properties file in spring boot在 Spring Boot 中的 application.properties 文件中定义地图列表
【发布时间】:2017-03-21 11:34:54
【问题描述】:

我正在使用 Spring Boot 框架,是否可以在 appllication.properties 文件中定义 HashMap 结构列表并在我的 java 类中使用该列表。这是属性文件中的示例结构。

prefix:
listProp1:
    - listValue1
    - listValue2
    - listValue3
listProp2:
    - listValue1
    - listValue2
    - listValue3
listProp3:
    - listValue1
    - listValue2
    - listValue3

【问题讨论】:

    标签: java spring-boot properties-file


    【解决方案1】:

    在属性文件中使用 JSON 结构

    myMap="{[{"mapKey1": "mapVal1","mapKey2": "mapVal2",},{"mapKey11": "mapVal11","mapKey21": "mapVal22",}]}"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-25
      • 2015-08-12
      • 1970-01-01
      • 2015-11-10
      • 2019-03-15
      • 2019-11-28
      • 1970-01-01
      相关资源
      最近更新 更多