Skip to content

io microsphere spring config env config ResourceYamlProcessor

github-actions[bot] edited this page Jun 18, 2026 · 18 revisions

ResourceYamlProcessor

Type: Class | Module: microsphere-spring-context | Package: io.microsphere.spring.config.env.config | Since: 1.0.0

Source: microsphere-spring-context/src/main/java/io/microsphere/spring/config/env/config/ResourceYamlProcessor.java

Overview

A YamlProcessor implementation that processes one or more YAML Resource resources into a structured map of properties. This class provides the ability to load and process YAML content from given Spring Resource objects, combining them into a single read-only Map of configuration properties.

Example Usage

`Resource resource = new ClassPathResource("application.yml");
ResourceYamlProcessor processor = new ResourceYamlProcessor(resource);
Map config = processor.process();
`

This will load the contents of application.yml into a map structure suitable for configuration purposes.

Multiple resources can be processed in the same way:

`Resource resource1 = new ClassPathResource("application.yml");
Resource resource2 = new ClassPathResource("override.yml");
ResourceYamlProcessor processor = new ResourceYamlProcessor(resource1, resource2);
Map config = processor.process();
`

In this case, properties from override.yml will override those from application.yml if there are key conflicts.

Declaration

public class ResourceYamlProcessor extends YamlProcessor

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.2.27-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

Example 1

Resource resource = new ClassPathResource("application.yml");
ResourceYamlProcessor processor = new ResourceYamlProcessor(resource);
Map<String, Object> config = processor.process();

Example 2

Resource resource1 = new ClassPathResource("application.yml");
Resource resource2 = new ClassPathResource("override.yml");
ResourceYamlProcessor processor = new ResourceYamlProcessor(resource1, resource2);
Map<String, Object> config = processor.process();

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-spring-context</artifactId>
    <version>${microsphere-spring.version}</version>
</dependency>

Tip: Use the BOM (microsphere-spring-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.spring.config.env.config.ResourceYamlProcessor;

This documentation was auto-generated from the source code of microsphere-spring.

Home

spring-context

spring-guice

spring-jdbc

spring-test

spring-web

spring-webflux

spring-webmvc

Clone this wiki locally