Initializing Mule application from Java


properties files are the files used in enterprise applications to store the configurable parameters settings of the application. Each property is stored as Key/Value pair.

Mule also uses properties files in its application to store the application settings which are mostly used to initialize the values of Connectors and Components. In Mule, the developers use to maintain all the properties files under src/main/resources folder.

In this blog, we will see a new way to initialize the values of Connectors and Components of Mule application. Instead of using properties files we will use a new way to load the values into the application using a Java file.

Yes! A Java class can be used to initialize and store the application’s configurable parameters settings.

Here is how we can do:-

We need to first create a Java class that will be used as the alternative way of properties files to initialize the values of Connectors and Components in the Mule application. We can create the following Java class under com.resources package as below:


The above Java class loads the properties in the application. We have defined various properties in the above Java class as a Key/Value pair. We can see, we have declared mainly HTTP properties here.

Now we need to use Spring Framework in our Mule application that loads these properties and make it available for the application in the Mule XML. We will use the following Mule config as below:-


Here we can see above, we have parameterized the HTTP listener values with the properties values from the Java class. Even we have used properties value in the Dataweave here status:p('successCode') as :number. 

Testing our Application:

So, if we test our Mule application with the HTTP host, port and path defined in the Java class as properties in the following url as below:


We will get below:



As we can see, we have used an alternative approach to initialize our Mule application from a Java class, defining all the configuration and settings there.

Hope you like this article and we will discuss some more new topics in our next blogs.


Anirban Sen Chowdhary

Anirban Sen Chowdhary is an information technology professional currently working on Java/J2ee, Esb and Integration platform. For more information, please visit and you can also follow

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>