简体   繁体   中英

include properties in another properties file

First of all, I apologize for my approximative english ;)

I load two properties file in xml like this

<propertyPlaceholder id="properties" 
                     location="path/to/my/properties/folder/file2.properties,
                               path/to/my/properties/folder/file1.properties"/>

my properties files look like this :
file1.properties

endpoint-from=rest:post:useraccounts:
endpoint-to=http4://${host}:${port}/endpoint

file2.properties (mocked variable for the example)

host=0.0.0.0
host=9999

Yes we talk about camel routing (v2.17)
when I launch my app, il seems that the variables host and port are not populated. Is it possible to do this this way, use variables from another properties file inside an specific properties file ?

Why I would like to do this ? I have multiple configuration file which called the two or three external services and if my host changes (migration, different environment), it is easier to change only the host variable in file2 instead of changing all host in all others files (I have more than 60 endpoints declared.

I hope i am clear enough to make myself understand and I hope you can and will help me

In your routes, you can use the following syntax:

${properties:bar.end?locations=com/mycompany/bar.properties}

In your actual property files, I'm not sure if is possible.

R.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM