我正在使用 Spring Boot 框架,是否可以在 appllication.properties 文件中定义 HashMap 结构列表并在我的 java 类中使用该列表。这是属性文件中的示例结构。
prefix:
listProp1:
- listValue1
- listValue2
- listValue3
listProp2:
- listValue1
- listValue2
- listValue3
listProp3:
- listValue1
- listValue2
- listValue3
最佳答案
在属性文件中使用 JSON 结构
myMap="{[{"mapKey1": "mapVal1","mapKey2": "mapVal2",},{"mapKey11": "mapVal11","mapKey21": "mapVal22",}]}"
关于java - 在 Spring Boot 中的 application.properties 文件中定义映射列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42925967/