Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Read mule-app.properties File Inside Your Mule Flow [Snippet]

DZone's Guide to

How to Read mule-app.properties File Inside Your Mule Flow [Snippet]

This quick snippet will let you be able to see the mule-app.properties file in your Mule Flow.

· Integration Zone
Free Resource

Build APIs from SQL and NoSQL or Salesforce data sources in seconds. Read the Creating REST APIs white paper, brought to you in partnership with CA Technologies.

Hello everyone,

Here I will show you how to see the mule-app.properties file inside your Mule flow.

You just need to add these lines of code in your Java component class, which will enable you to read the property file and load it into a Properties object:

I hope this helps!

public class PropertySampleReader {

    Properties prop = new Properties();
    InputStream input = null;

    public String propertyRead() throws IOException {
        @SuppressWarnings("unused")
        Properties properties = System.getProperties();
        System.out.println(properties);
        System.out.println(properties.get("company"));

        input = getClass().getResourceAsStream("/mule-app.properties");
      
        prop.load(input);

        System.out.println(prop);
        return "XYZ";
    }
}

The Integration Zone is brought to you in partnership with CA Technologies.  Use CA Live API Creator to quickly create complete application backends, with secure APIs and robust application logic, in an easy to use interface.

Topics:
mule esb ,mulesoft ,muleesb ,mule school ,mulestudio

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}