<!--配置文件-->
<property name="ppp">
<props>
<prop key="11">hello</prop>
<prop key="22">bye</prop>
</props> </property>
</bean>
取值App1类代码:
System.out.println("****通过properties取出数据*****");
Properties pp=department.getPpp();
// System.out.println(pp.get("11").toString());
for(Entry<Object, Object> entry:pp.entrySet()){
System.out.println(entry.getKey().toString()+""+entry.getValue());
}
System.out.println("***通过枚举取出来***");
Enumeration en=pp.keys();
while(en.hasMoreElements()){
//Entry<Object,Object> element=(Entry<Object,Object>)en.nextElement();
//System.out.println(element.getKey()+""+element.getValue());
String key=(String) en.nextElement();
System.out.println(key+""+pp.getProperty(key));
}