java - 如何使用 org.apache.commons.configuration.PropertiesConfiguration 在分隔符之间创建没有空格的属性?
问题描述
需要使用 org.apache.commons.configuration.PropertiesConfiguration 编写一个属性文件,它应该具有类似variablename=variablevalue的格式,并且分隔符之间没有空格。有没有办法使用 apache commons-configuration 来实现?
我目前的实现:
PropertiesConfiguration conf = new PropertiesConfiguration("test.properties");
conf.setProperty("key1","value1");
conf.save();
结果 :
key1 = value1
预期结果 :
key1=value1
解决方案
文档在这里:https ://commons.apache.org/proper/commons-configuration/userguide_v1.10/howto_properties.html
未经测试,但我想这样做:
conf.getLayout().setGlobalSeparator("=");
推荐阅读
- python - 如何用 abi 标签创建一个完整的轮子?
- vue.js - 当另一个观察者正在运行时取消观察任何观察者
- visual-studio-code - 如何使用 vscode 命令行附加远程容器?
- dymola - 在 Dymola 中使用“readTrajectory”函数编写向量
- mysql - 如何在mysql数据库中插入多部分表单数据?
- php - 使用 PHP 提供 ZIP 文件内容,无需解压缩到临时位置
- c# - 捕捉按键事件
- laravel - Laravel Route 未为 registercontroller 定义
- angular - 如何遍历数组并使用角度rxjs计算总和
- ssl - 如何禁用 SSL 2.0 和 3.0