Mule Tip: Multiple PropertyPlaceholders in same Mule Configuration

February 3 2012

5 comments 0
motif

If you want to avoid including parameters (probably connection related parameters) in your Mule , you can use property placeholders, which will allow you to upload these parameters from a properties file. This enables you, for example, to have different property files for different environments (Dev, QA, Prod) or allows you to reuse the same value in different parts of your .

I recently ran into the case where I wanted to configure specific configuration parameters in different properties files. Basically I wanted to have two files sap.properties and jdbc.properties in the classpath and make the values in each these property files available in Mule configuration as Spring property placeholders. The trick here is to add the property ignoreUnresolvablePlaceholders and set it to true in the first placeholder, so that Spring will load values for the next ones.

The default value for the property ignoreUnresolvablePlaceholders is false, and if not set, the previous Mule code will through the following exception:

Stay tuned for more Mule Tips!


We'd love to hear your opinion on this post

5 Responses to “Mule Tip: Multiple PropertyPlaceholders in same Mule Configuration”

  1. Hi,

    I guess you can achieve the same behavior using a comma separated list, like:

    With the context namespace:

    xmlns:context=”http://www.springframework.org/schema/context”

    /Tomas Blohm

    Agree(0)Disagree(0)Comment
    • Hi Tomas. Thanks for your comment. It sees like part of your comment was a piece of code we are not able to see. Can you please post it again without formatting or send it to me so I can share it with others?
      Thank you very much.

      Agree(0)Disagree(0)Comment
  2. I add multiple properties files by separating them with a comma, like this:

    Agree(0)Disagree(0)Comment
    • Hi Henrik. Thanks for your comment. For some reason part of the code you posted is not visible in your comments. Can you please share it again without formatting or send it to me so I can share it with the rest of the readers.
      Thanks again.

      Agree(0)Disagree(0)Comment
  3. OK, here it comes again:
    context:property-placeholder location=”sap.properties,jdbc.properties”

    Agree(0)Disagree(1)Comment