Mule Tip: Multiple PropertyPlaceholders in same Mule Configuration

motif

If you want to avoid including configuration parameters (probably connection related parameters) in your Mule configuration, 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 configuration.

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!