Java – use the properties in the properties file

I apologize for the title I can't find a better way to explain the situation

I use the property class to load property files, such as URLs http://www.exampledepot.com/egs/java.util/Props.html As described in

My question is, can I use properties in this property file?

Example:

test. properties

url.main="http://mysite.com"
    url.games={url.main}/games
    url.images={url.main}/images
    .
    .
    .

Can I use other syntax?

thank you

Solution

I've never seen it before Of course you can make your own preprocessor As long as the referenced property occurs before any reference to it, you should be able to implement it with some regular expression / String substitution But: I don't recommend this method

Better address duplication by defining different attributes:

>Change: URL games = {url.main} / games into url. games_ extension = / games> prepend:url. Main to URL games_ Extension to get the full game URL in the application code

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>