如何在可以使用 Spring 的 @Value 注入的属性文件中创建 Map<String, List<String>> 属性

How to create a Map<String, List<String>> property in properties file that can be injectable using Spring's @Value

如何在可以使用 Spring 的 @Value 注入的属性文件中创建 Map<String, List<String>> 属性?

属性 java 文件中的示例代码片段

@PropertySource({"file:salesforce-service.properties"})
public class Properties {
    @Value("#{${student.hobbies}}")
    private Map<String, List<String>> hobbies;
}

这是属性文件中的答案和示例代码片段:

student.hobbies={indoor: 'reading, drawing', outdoor: 'fishing, hiking, bushcraft'}

参考:https://stackabuse.com/the-value-annotation-in-spring/ 部分 --> 注入地图