Contact Us 1-800-596-4880

About Configuration Builders

This configuration builder is responsible for creating the configuration that’s used at run time from the configuration files your provide. Mule ESB provides two standard configuration builders, or you can create your own.

SpringXmlConfigurationBuilder

The default configuration builder used to configure Mule is the SpringXmlConfigurationBuilder. This configuration builder uses Spring to configure Mule based on one or more XML files leveraging custom Mule namespaces. For more information, see About the XML Configuration File.

ScriptConfigurationBuilder

This configuration builder allows a JSR-223 complaint script engine such as Groovy or Jython to configure Mule. For more information, see Scripting Module Reference.

Custom Configuration Builder

You can easily create your own custom configuration builder by implementing the [ConfigurationBuilder] interface, which has a method configure. Typically, you call configue(MuleContext muleContext.getRegistry()) to get access to Mule’s internal registry, which contains the configuration information, and to register services and other elements.

In most cases, you will want to inherit from the AbstractResourceConfigurationBuilder, which will make any configuration files specified on the command line available in an instance variable called configResources.

Specifying the Configuration Builder

AutoConfigurationBuilder is the default configuration builder. If you want to use another configuration builder, you can specify it in the deployment descriptor of an application.

You can also specify the configuration builder as a parameter to the MuleContextFactory when starting Mule programmatically:

MuleContext context = new DefaultMuleContextFactory().createMuleContext(new ScriptConfigurationBuilder("mule-config.groovy"));
context.start();