In modern applications, configuration plays a crucial role in maintaining flexibility and modularity. Often, we need to load properties from multiple YAML files, organized across nested directories, to ensure scalability and modular configuration. In this blog, we’ll explore how to dynamically load all YAML files from a specific directory structure and merge their properties into a single configuration object. Use Case Imagine we have a configuration directory like this: src/main/resources ├── application.yml ├── configs │ ├── environment │ │ ├── dev.yml │ │ ├── qa.yml │ ├── features │ │ ├── feature1.yml │ │ ├── feature2.yml We want to load all YAML files under the configs directory (including subdirectories), merge them, and make the properties available for use in our Spring Boot application. Implementation 1. Dynamic YAML Loader We will create a utility class to dy...