Nav

Using Mule with Spring

Mule leverages the Spring framework for developing Java applications. Mule ESB 3.7 and later supports the latest version of the framework, Spring 4.1.6, making use of the Eclipse-based development environment.

XML Configuration File

The way to configure a Mule application is with an XML file that uses custom Mule namespaces. By default, a Spring configuration builder takes this XML file to create Mule artifacts and register them with a Mule runtime instance.

Use one of the two namespaces in your Mule XML Configuration file:

  • http://www.springframework.org/schema/beans

  • http://www.springframework.org/schema/beans/spring-beans-current.xsd

Spring Application Contexts

Mule offers several options for creating and managing Spring Application Contexts for your application.

Build Spring beans to define component behaviors which Mule applications can reference. See Using Spring Beans as Flow Components

Spring Bean Definition Profiles

Mule’s XML configuration file takes advantage of Spring 4.1.6’s ability to create bean definition profiles. You can use Spring bean definition profiles to register different beans for different target environments, instead of using one bean for all target environments. For more information, see Bean Definition profiles in the Spring Framework Reference.