DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Security Is a Platform Property, Not a Pipeline Step
  • An XGBoost Property Valuation Postmortem: Leakage, Overfitting, and SHAP Surprises
  • Comprehensive Guide to Property-Based Testing in Go: Principles and Implementation
  • Implement Hibernate Second-Level Cache With NCache

Trending

  • Data Integration Landscape 2026: Event Streaming, API, and Batch in the Era of Agentic AI
  • Build Software Faster With Three Simple Principles
  • AI-Era Cybersecurity, Part 1: Mapping Glasswing, Daybreak, Lightwell and the Tools Racing to Find and Fix Bugs
  • Kafka With Spring Boot: Introduction

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

Configuring Properties in Mule 4 vs Mule 3

Read on to discover the differences between Mule 3 and Mule 4. Also learn how to use values configured within each of them.

By 
Sadik Ali
·
May. 15, 18 · Tutorial
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
30.7K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

Many changes have been introduced in Mule 4 in comparison with Mule 3.

In Mule 3 :

Property configuration was done using global configuration in Mule flow.

In component configurations -> Property PlaceHolder

Image title

In the selection below, you have been provided configuration to avail attribute values configured in the property file.

Image title

With simple configuration, the developer can access the value configured in the property file.

Property file:

name=Mule3Properties

Flow as below:

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:context="http://www.springframework.org/schema/context" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-current.xsd">
    <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8082" doc:name="HTTP Listener Configuration"/>
    <context:property-placeholder location="configSample.properties"/>
    <flow name="mule3propertyfileFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/mule3Property" allowedMethods="GET" doc:name="HTTP"/>
        <set-payload value="${name}" doc:name="Set Payload"/>
    </flow>
</mule>

Application deployed :

logs :

* Application: mule3propertyfile                                     *
* OS encoding: \, Mule encoding: UTF-8                               *
*                                                                    *
* Agents Running:                                                    *
*   DevKit Extension Information                                     *
*   Batch module default engine                                      *
*   JMX Agent                                                        *
*   Wrapper Manager                                                  *
**********************************************************************
INFO  2018-05-07 22:21:38,580 [Mule.app.deployer.monitor.1.thread.1] org.mule.module.launcher.MuleDeploymentService: 
**********************************************************************
* Started app 'mule3propertyfile'                                    *
**********************************************************************

Access system to validate property file value access:

Image title

Now let's check the changes that came in Mule 4:

To avail values configured in new version Mule 4, configuration property file has to configure in the screen below.

To go to global configuration ->choose global configuration -> select configuration properties

Image title

Configure the property file that you want to access in the application for configured values.

Image title

Property file data:

name=Mule4Properties

Flow file to access property file's configured values:

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<configuration-properties doc:name="Configuration properties" doc:id="c6141991-4e6e-4a8a-ab76-a3d770686d64" file="development.properties" />
<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="6b71321e-97a5-4e1d-84b4-ba2645856256" >
<http:listener-connection host="0.0.0.0" port="8081" />
</http:listener-config>
<flow name="propertyconfigurationFlow" doc:id="57c94a9d-0194-4265-bcbe-549c420eb15d" >
<http:listener doc:name="Listener" doc:id="57914745-ce3e-4cbd-8388-c886bd881c05" config-ref="HTTP_Listener_config" allowedMethods="GET" path="/getProp"/>
<set-payload value="${name}" doc:name="Set Payload" doc:id="ede5f918-ac6d-4e8e-bfc7-7f1fbfe21860" />
</flow>
</mule>

After the above configuration, start the application.

Here are the logs:

* Started app 'Mule4property'                                        *
* Application plugins:                                               *
*  - Sockets                                                         *
*  - HTTP                                                            *
**********************************************************************
INFO  2018-05-07 22:17:09,254 [WrapperListener_start_runner] com.mulesoft.agent.configuration.postconfigure.DefaultPostConfigureRunner: Initializing the scheduling.notification.internal.message.handler ...
INFO  2018-05-07 22:17:09,254 [WrapperListener_start_runner] com.mulesoft.agent.configuration.postconfigure.DefaultPostConfigureRunner: scheduling.notification.internal.message.handler initialized successfully.
INFO  2018-05-07 22:17:09,258 [WrapperListener_start_runner] org.mule.runtime.module.deployment.internal.DeploymentDirectoryWatcher: 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Mule is up and kicking (every 5000ms)                    +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO  2018-05-07 22:17:09,270 [WrapperListener_start_runner] org.eclipse.jetty.server.AbstractConnector: Started ServerConnector@3d61ba5c{HTTP/1.1,[http/1.1]}{0.0.0.0:50166}
INFO  2018-05-07 22:17:09,272 [WrapperListener_start_runner] org.mule.runtime.module.deployment.internal.StartupSummaryDeploymentListener: 
**********************************************************************
*              - - + DOMAIN + - -               * - - + STATUS + - - *
**********************************************************************
* default                                       * DEPLOYED           *
**********************************************************************

*******************************************************************************************************
*            - - + APPLICATION + - -            *       - - + DOMAIN + - -       * - - + STATUS + - - *
*******************************************************************************************************
* Mule4property                                 * default                        * DEPLOYED           *
*******************************************************************************************************

Access the system URL and it will show the property file configured value.

Image title

No major changes were done, only component name and it's attributes have been changed.

Thanks, MuleSoft.

Property (programming)

Opinions expressed by DZone contributors are their own.

Related

  • Security Is a Platform Property, Not a Pipeline Step
  • An XGBoost Property Valuation Postmortem: Leakage, Overfitting, and SHAP Surprises
  • Comprehensive Guide to Property-Based Testing in Go: Principles and Implementation
  • Implement Hibernate Second-Level Cache With NCache

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook