About Configuration Builders
The configuration builder is responsible for creating the configuration that’s used at run time from the configuration files you provide. Mule runtime provides two standard configuration builders, or you can create your own.
The default configuration builder used to configure Mule is the
SpringXmlConfigurationBuilder. This configuration builder uses Spring to configure a Mule runtime instance based on one or more XML files leveraging custom Mule namespaces. For more information, see About the XML Configuration File.
This configuration builder allows a JSR-223 compliant script engine such as Groovy or Jython to configure Mule. For more information, see Scripting Module Reference.
You can easily create your own custom configuration builder by implementing the ConfigurationBuilder interface, which has a method
configure. Typically, you call
configure(MuleContext muleContext.getRegistry()) to get access to Mule’s internal registry, which contains the configuration information, and to register objects and other elements.
In most cases, you will want to inherit from the class
, which will make any configuration files specified on the command line available in an instance variable called
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 programatically:
MuleContext context = new DefaultMuleContextFactory().createMuleContext(new ScriptConfigurationBuilder("mule-config.groovy")); context.start();