By default, java.util.Properties does not support this. However, it's not very hard to add this behaviour yourself. In fact, I have done just that myself.
I won't give you the full code for two reasons: 1) we are
NotACodeMill, and 2) my code is licensed under GPLv2, and that has some limitations what you can do with the code.
I will however give you a few hints:
1) Extend or wrap java.util.Properties. Add a new method; e.g.
String getExpandedProperty(String key)
2) This method should get the original property (
getProperty(key)), and then replace all occurrences of {abc} with the values of property abc. You can use a java.util.regex.Pattern for finding those occurrences. If you make this method recursive, you can even use variables inside variables.
3) If you make your method recursive, beware of cyclic variables. If one variable contains another variable which again contains the first variable, you could get either an infinite loop or a StackOverflowException. I have used a Map<String, String> to cache values; if a key is first encountered I store it in this Map, then I set its value once it's resolved. If a key is already in the Map then I do not try to replace it again.