- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个返回配置对象的方法。我需要实例化一个 PropertiesConfig 对象以将其保存到磁盘。我怎样才能这样做?
最佳答案
您尝试过使用复制方法吗?这个例子对我有用:
XMLConfiguration conf1 = new XMLConfiguration("table1.xml");
XMLConfiguration conf2 = new XMLConfiguration("table2.xml");
// Create and initialize the node combiner
NodeCombiner combiner = new UnionCombiner();
combiner.addListNode("table"); // mark table as list node
// this is needed only if there are ambiguities
// Construct the combined configuration
CombinedConfiguration cc = new CombinedConfiguration(combiner);
cc.addConfiguration(conf1, "tab1");
cc.addConfiguration(conf2);
PropertiesConfiguration config = new PropertiesConfiguration("usergui.properties");
config.copy(cc);
config.save();
关于java - 给定一个 Configuration 对象,如何创建 PropertiesConfiguration 对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18070132/
我希望每 xx 秒重新加载我的属性文件。我的代码: ... configuration = new PropertiesConfiguration(); configuration.setFileNa
我正在使用 PropertiesConfiguration 加载和存储属性值。 如果我在属性值中使用字符“/”,它会被保存为“\/”。你能帮我保存'/'而不是'\/'吗?我在这里遗漏了什么吗? Pro
假设我有以下两个配置文件: 文件1: key1 = ${common.key1} key2 = ${common.key2} 文件2: common.key1 = value1 common.key2
背景: 我要求向用户显示的消息必须因语言和公司部门而异。因此,我不能使用开箱即用的资源包,所以我实际上是在使用 PropertiesConfiguration 文件编写我自己的资源包版本。 此外,我有
为了更新我的 .properties 文件,我使用 Apache Commons Configuration 的 PropertiesConfiguration .但是当我使用代码时: try {
我有一个带有 List 值(逗号分隔)的属性的属性文件,如何将这个属性写成多行? (逗号后的反斜杠)? 我找不到任何关于这个或至少关于将逗号转义为逗号和反斜杠的信息。 最佳答案 如果您的意思如下;这仅
我有一个 PropertiesConfiguration 对象。我可以多次调用 getInt()、getString() 等而不关心性能吗?我的意思是,它不会每次都从文件中读取或以任何其他方式降低我的
我正在尝试设置一个FileBasedConfigurationBuilder,以便我可以使用PropertiesConfiguration,但我收到一个NoClassDefFoundError。这是我
我使用 Apache 配置设置了以下配置: import org.apache.commons.configuration.Configuration; import org.apache.commo
我是新手,擅长使用grails。 在我的grails应用程序中,我必须使用apache commons以下代码编辑属性文件,而不删除该Iam的其他键值 PropertiesConfiguration
PropertiesConfiguration.java 没有 close() 方法。是否还需要执行其他操作才能释放该文件?我想在生产中使用它之前确定一下。我查看了代码,但没有看到任何内容。我不完全确
我们有一个“.properties”文件,其中一些值以 JSON 形式保存。不过,我总是被特殊字符困扰—— org.json.JSONObject 对于导致它窒息的原因并不是很详细,所以需要很长时间才
这个让我难住了。 我有这样的东西: PropertiesConfiguration pc = new PropertiesConfiguration(); pc.setProperty("url",
我有一个返回配置对象的方法。我需要实例化一个 PropertiesConfig 对象以将其保存到磁盘。我怎样才能这样做? 最佳答案 您尝试过使用复制方法吗?这个例子对我有用: XMLConfi
我们有一个使用 .properties 来存储语言翻译的应用程序。我们尝试使用 PropertyResourceBundle 和 PropertiesConfiguration(独立)访问它们。在本地
我正在使用 PropertiesConfiguration编辑属性文件。这允许我保留评论。除了最后一个键之后的评论之外,一切正常.. 例如输入文件 # *** A comment GameCheck.
我想加载属性文件和命令行参数,然后在运行时动态配置日志记录,我以前可以这样做: Properties configuration; ... ByteArrayOutputStream os = new
我是一名优秀的程序员,十分优秀!