在Java Spring中维护每个端点的静态国家列表

时间:2016-10-21 07:56:15

标签: spring hashmap properties-file

需要从属性文件维护特定属性(端点)的静态国家/地区列表。  我们如何维护清单? 应该为静态列表定义ENUM,或者从不同的属性文件

加载国家和端点

1 个答案:

答案 0 :(得分:1)

在xml配置中定义地图和列表,如下所示

resetAll() {
  this.listItems.forEach((item) => {
    item.checked = false;
  })

在您的课程中将上述地图注入

<util:map id="endPtMap">
    <entry key="endPt1">
        <ref bean="countryList1" />
    </entry>
    <entry key="endPt2">
        <ref bean="countryList2" />
    </entry>
</util:map>

<util:list id="countryList1" value-type="java.lang.String">
    <value>UK</value>
    <value>US</value>
</util:list>

<util:list id="countryList2" value-type="java.lang.String">
    <value>UK</value>
    <value>AUS</value>
    <value>IN</value>
</util:list>