我可以在属性文件中引用另一个属性(使用$ {property}) [英] Can I reference another property in a properties file (use ${property})

查看:431
本文介绍了我可以在属性文件中引用另一个属性(使用$ {property})的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

如何在java.util.Properties中引用另一个属性?

查看我的file.properties:

look at my "file.properties":

key1= My name is
key2= ${key1} Martin !






为什么当我得到key2的值时我的结果是$ {key1}马丁!不像我的名字是马丁!


Why when I get the value of "key2" my result is "${key1} Martin !" unlike "My name is Martin !"

=>我在Java 6编程

=>我使用java.util.Properties

=> I program in Java 6
=> I use java.util.Properties

推荐答案

您可能需要查看Apache配置,

You might want look at Apache Configuration,

http://commons.apache.org/configuration/

它支持的许多功能包括可变插值

Among many features it supports is the Variable Interpolation.

这篇关于我可以在属性文件中引用另一个属性(使用$ {property})的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆