通过程序生成properties文件的工具类,并可根据添加顺序生成,可添加注释,调用步骤如下: 1.OutputOrderProperties p = new OutputOrderProperties(); 2.FileInputStream fs = new FileInputStream("文件路径"); 3.p.load(new InputStreamReader(fs, "utf-8")); 4.p.put("jdbc.name", dbConfig.getJdbcName(),"jdbc名称"); 5.p.orderStore(new OutputStreamWriter(os1, "utf-8"), null);