使用
[code="java"]Properties properties = new Properties();
InputStream in = Container.class.getResourceAsStream("beans.properties");
properties.load(in);[/code]
读取配置文件后,因为前后顺序有反射生成对象后面的使用。可是为什么读取不按顺序来呢?
关键是修改类名后就会按照顺序,可顺序是乱序的没有按字母顺序,真奇怪了,之前就没有遇到这种情况。
properties是无序的 所以还是用xml做吧
class Properties extends Hashtable
Properties是Map接口的实现类,map不是顺序的。