Contact Free trial Login

Configure Property Placeholders

Instead of using static values for your Mule application configurations, such as connections, you can create a .yaml or a .properties file to contain your properties and then reference the properties from your application.

Configuring a properties file improves the organization and maintainability of your applications.

In a .yaml file, the properties take this form:

  path: "/service"
  port: "10000"
  host: ""

In a .properties file, the properties take this form:


Create and Configure your Properties File

  1. Create a new .yaml or .properties file in your project, and store it in /src/main/resources.

  2. Edit the file to define the properties and values you need.

  3. Add the properties file to your Mule application.

    • From Studio:

      1. Open the Global Elements tab, and click the Create button.

      2. Search for the element called Configuration Properties and click OK.

      3. Click on the …​ button and navigate to your .yaml or .properties file.

    • From the XML Editor:

      1. Include a <configuration-properties> element inside <mule>, and set its file parameter with your properties file name. For example:

            doc:name="Configuration properties"
            doc:id="872422be-3571-4a52-a383-a2b0e16859d7" />`

Use the Properties in your Application

Once you have configured your properties file and added it to your project, you can reference its attributes by using a syntax like this: ${propertyContainer.propertyName}.

Based on the examples configured in the previous section, to use the path and port values the syntax is ${http.path} and ${http.port} respectively.

For example, you can configure your Global HTTP Request configuration to use the values defined in the properties file.

  • From Studio:

  • From the XML Editor

      doc:name="HTTP Request
      configuration" doc:id="7120494c-0540-4ad1-a118-f5b6db3f1456"
      basePath="${http.path}" >
          port="${http.port}" />