Can I reference another property in a properties file (use ${property})
You might want look at Apache Configuration,
http://commons.apache.org/configuration/
Among many features it supports is the Variable Interpolation.
Reference other variables in Java properties file
One of the options mentioned in the question that Michael linked to in his comment above that I feel may help you is eproperties. Looks pretty promising.
HTH!
Refer to one property from another?
To answer my own question, a quick peak at the code shows that Wicket loads properties using java.util.Properties, which simply parses a stream for key-value pairs. It does not do any property expansion/substitution the way that developers might expect based on their experience with tools like ANT.
There are alternatives to Properties
, like Apache Commons Configuration, that perform expansion but Properties
does not. Therefore, neither does Wicket - it simply loads the properties as they are written. The only substitution Wicket does is for model properties when a page is rendered, not for properties in the "properties file" sense of the word.
Spring properties that depend on other properties
Spring can combine properties
myDir=/path/to/mydir
myFile=${myDir}/myfile.txt
You can also use a default value without defining your myFile
in the properties at first:
Properties file
myDir=/path/to/mydir
In class:
@Value("#{myFile:${myDir}/myfile.txt}")
private String myFileName;
Related Topics
Calling Outer Class Function from Inner Class
Primitive Type 'Short' - Casting in Java
Has Been Compiled by a More Recent Version of the Java Runtime (Class File Version 57.0)
Varargs and the '...' Argument
Converting Any Object to a Byte Array in Java
How to Move a File from One Location to Another in Java
Helper in Order to Copy Non Null Properties from Object to Another
How to Do a True Java Ping from Windows
Configure Hibernate (Using JPA) to Store Y/N for Type Boolean Instead of 0/1
How Is Values() Implemented for Java 6 Enums
How to Add an Image to a Jbutton
Correct Way to Close Nested Streams and Writers in Java
Get the Index of a Pattern in a String Using Regex
Take N Random Elements from a List<E>
How to Refer Environment Variable in Pom.Xml