Mule ESB:Context Property Placeholder

11,949

Solution 1

Each will be loaded in turn, overwriting duplicate properties from the first one. So in your case, properties defined in mule-app-2.properties will take precedence.

Towards the end of this article I described using this method to provide environment specific configuration properties.

Solution 2

Yes, you can have multiple files loaded through Mule context property placeholder. Correct way to do it is to place the properties file in src/main/resources, this folder is in classpath and then specify something like this:

<context:property-placeholder location="mule-app-1.properties, mule-app-2.properties" />

I am not sure why would you want to define duplicate properties in them

EDIT:

To specify order of loading multiple files, use order attribute:

<context:property-placeholder location="mule-app-1.properties" order="1"/>
<context:property-placeholder location="mule-app-2.properties" order="2"/>

Solution 3

Your configuration should be as follows:

 <context:property-placeholder location="mule-app.properties, file:C://Users//schiraboina//Desktop//123.txt"/>

In the above case you are trying to read the values by using '${key_name}'.The order of precedence will be 1. mule-app.properties 2. Read file from external location

Share:
11,949

Related videos on Youtube

insaneyogi
Author by

insaneyogi

Updated on September 15, 2022

Comments

  • insaneyogi
    insaneyogi over 1 year

    I have a question regarding Mule's context property placeholder, I have two files set up like this:

    <context:property-placeholder location="classpath:mule-app-1.properties, file:///etc/mule/conf/mule-app-2.properties" /> 
    

    Firstly is this a valid configuration, secondly which file will take precedence over the other? app1 or app2 file?

    -S

  • insaneyogi
    insaneyogi over 10 years
    so which file would be loaded first , app-1 or app-2? Do you know which takes precedence?
  • insaneyogi
    insaneyogi over 10 years
    So my question really is if the order attribute is NOT specified, & I have the two properties files setup will that cause an error or is there a default ordering imposed? If so what is the default ordering.
  • Charu Khurana
    Charu Khurana over 10 years
    I've answered your 1st question and added spring tag for your 2nd question as that is really a spring and not mule question. I would suggest you try putting duplicate values and check yourself the ordering