• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is it possible to do concatenation in property files  RSS feed

 
Vinod Vijay
Ranch Hand
Posts: 165
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have a property file with following properties:-

directory=/opt/app/test/main
subdirectory=/opt/app/test/main/sub

I was wondering if I can concatenate something like this
directory=/opt/app/test/main
subdirectory=directory/sub

Can you suggest me correct syntax of doing concatenation in property file?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no built-in mechanism to have something like variables in a property file, which get resolved automatically. You would have to program this yourself.
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As mentioned, no direct support is there for properties file .. but I think some of the web frameworks like Struts do provide a way to do this concatenation. But you need to check on google for this.
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apache Commons Configuration supports variable interpolation, which is what you're looking for.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As soon as I read the first post, I thought of Apache Commons Configuration. We use it quite heavily at work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!