0

In .properties file is it possible to do something like this:

DB_USERNAME=xyz123
DB_PASS=abc111

DB_USERNAME_UTIL=DB_USERNAME
DB_PASS_UTIL=DB_PASS

It might seem weird. You may ask why do we need two different property if the value of both is same. Well, i don't know the answer of this question but i have to do it or simply conclude that we can't do it.
I remember I have seen somewhere in a .properties file

property1=world
property2=Hell {property1}!

and the value of property2 was printed as 'Hell World!'

Rakesh Juyal
  • 35,919
  • 68
  • 173
  • 214
  • This was asked and answered here: http://stackoverflow.com/questions/872272/java-properties-file-how-to-reference-already-defined-property-later-dir-defau – Roman Goyenko Nov 11 '10 at 16:23

1 Answers1

1

AFAiK this is not possible using standard java.util.Properties methods. You should use a custom class to read this property file.

Guillaume
  • 5,535
  • 1
  • 24
  • 30