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.
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.
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.
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 class AbstractResourceConfigurationBuilder, 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 programmatically:
1 2 MuleContext context = new DefaultMuleContextFactory().createMuleContext(new ScriptConfigurationBuilder("mule-config.groovy")); context.start();