Contact Us 1-800-596-4880

Configuring Properties

This page describes configuring properties, such as property placeholders and system properties.

Property Placeholders

You can use Ant-style property placeholders in your Mule ESB configuration. For example:

The values for these placeholders can be made available in a variety of ways, as described in the sections below.

Global Properties

You can use the <global-property> element to set a placeholder value from within your Mule configuration, such as from within another Mule configuration file:

Properties Files

To load properties from a file, you can use the standard Spring element
<context:property-placeholder>:

where the contents of smtp.properties is:

To load multiple properties files, separate them with commas:

Message Properties

You can use placeholders to perform logic on message properties such as the header. For example, if you wanted to evaluate the content-type portion of the message header, you would specify it as #[message.inboundProperties['Content-Type']]. Typically, you use message property placeholders with expressions. For more information, see Mule Expression Language MEL.

System Properties

The placeholder value can come from a JDK system property. If you start Mule from the command line, you would specify the properties as follows:

or edit the system properties in conf/wrapper.conf if you are deploying Mule as a webapp. When running Mule in a container, as of Mule 2.2.2 you can also specify the server ID in the web.xml file as follows:

If you start Mule programmatically, you would specify the properties as follows before creating and starting the Mule context:

There are also several system properties that are immutable after startup. To set these, you customize the MuleConfiguration using the set method for the property (such as setId for the system ID), create a MuleContextBuilder, load the configuration to the builder, and then create the context from the builder.

For example:

For information on the set methods you can use to set system properties, see:

For information on configuration builders, see About Configuration Builders.

Environment Variables

There are several ways to access environment variables, but there is no standard way.

See Also

  • Read more about mule messages and their properties in our MuleSoft Blog.