How to get list of properties using apache.commons

前端 未结 3 1276
走了就别回头了
走了就别回头了 2021-02-14 02:48

I need to get the list of properties which are in the .properties file. For example, if have the following .properties file:

users.admin.keywords = admin
users.a         


        
3条回答
  •  野性不改
    2021-02-14 03:10

    You can use as below:

    Configuration configuration = new PropertiesConfiguration(filename);
    Iterator keys = configuration.getKeys();
    List keyList = new ArrayList();
    while(keys.hasNext()) {
        keyList.add(keys.next());
    }
    

提交回复
热议问题