有其结构如下属性文件:转换用逗号分隔的字符串映射的属性映射<字符串,列表<String>>
prob1=a,b,c,d
prob2=e,f,j,h
我们希望将其转换为Map<String,List<String>>
我知道我可以看地图,从属性文件创建一个映射bean作为:
<util:properties id="probs"
location="classpath:/configs/sample.properties" />
我知道,我可以转换逗号分隔字符串列表与列出:
@Value("#{'${prob1}'.split(',')}")
private List<String> Probs;
但我不知道我怎么能实现Map<String,List<String>>
也许你应该看看'Properties.entrySet()',看看这可能导致。 –
你能解释一下吗?!我怎样才能访问这个方法? –
'属性扩展HashTable <对象,对象>' - 我会在下面完整回答 –