Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+

About Property Placeholders in Mule Apps

Instead of using static values for connections and other configurations in your Mule app, you can create and use property placeholders that you define in a configuration file. You can manage the values from the configuration file and through system properties. Using system properties is useful if you need to change the settings when deploying to a new environment, as when you promote the application to a production environment.

Typical use cases:

  • The configuration file provides default values that you can override through system properties.

  • You use a system property to choose a file with the properties that you need for the environment. In this case, you might have a configuration file for two different environments, for example, one file for development, another for production.

General tasks for these use cases:

  • Specifying each placeholder in a configuration file, for example:

    • In a YAML file: port: 8080

    • In a properties file: port=8080

  • Passing the key for the placeholder (such as ${port}) to a connector or component in your Mule app.

  • Creating a global configuration property for your Mule app that references the configuration file, for example:

    <configuration-properties file="dev.yaml"/> or <configuration-properties file="${environment}.yaml"/>

    In the Studio UI, this XML is generated when you create a Global Element of type Configuration Properties.

    Note that .properties files are also acceptable here.

  • Specifying system properties as arguments to the command used to run the Mule app, for example:

    • Passing in -Dport=80 to change the values of the placeholders in the configuration file.

    • Passing in -Denvironment=prod to change the configuration file that you pass to the global configuration property.

More information about performing these tasks is available in the topics listed in the See Also section.

In this topic: