YAML file as Configuration Property In Mule


As part of this tutorial we will demonstrate how can we use YAML file to define property in hierarchical manner and consume the property from inside the dataweave or mule configuration. Also, we will show how we can define secure property as YAML and refer the secure property from another YAML file

Create a sample project in Anypoint studio

Create a folder(optional) to define the YAML as property file


Define the properties inside dev.yaml file, you can also see how we refer the secure property from secure-dev.yaml(defined below) inside dev.yaml




    host: ""
      file: "ssl/server-keystore-dev.p12"
      alias: "server"
      password: "${secure::keystore.password}"
      file: "ssl/client-truststore.p12"
      alias: "localhost-client"
      password: "${secure::truststore.password}"
      connection-idle: "600000"
   port: "8092"
  port: "8082"
      connection-idle: "500000"
      response: "40000"


Define Secure properties




  password: "![kiwQK955ycpgW9LT1kzXzA==]"

  password: "![kiwQK955ycpgW9LT1kzXzA==]"


Drag and drop listener configuration and configure the property using yaml file


In a similar way configure the property for TLS that also includes secure property

YAML file As Configuration Property In Mule


To use configuration file and secure configuration file we need to define this as part of Global Elements, we can see the Secure properties Config below

YAML file As Configuration Property In Mule


YAML property path


Secure YAML property path

YAML file As Configuration Property In Mule


Mule Key is required to encrypt and decrypt the property


Retrieve the property inside dataweave from YAML file

YAML file As Configuration Property In Mule


Sample Dataweave Expression:

%dw 2.0
output application/java
p('https.listener.host') ++ ":" ++ p('https.port')


Sample Project: Sample mule application

Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.
For any latest updates or posts on our website, you can follow us on LinkedIn. Look forward to connecting with you there.

Share this:
Notify of
Inline Feedbacks
View all comments