Class YamlPropertySourceFactory
- java.lang.Object
-
- io.microsphere.spring.config.env.support.YamlPropertySourceFactory
-
- All Implemented Interfaces:
org.springframework.core.io.support.PropertySourceFactory
public class YamlPropertySourceFactory extends java.lang.Object implements org.springframework.core.io.support.PropertySourceFactory
APropertySourceFactory
implementation that createsPropertySource
instances from YAML resources.This factory processes YAML files into a
Map
usingResourceYamlProcessor
, and wraps the result in anImmutableMapPropertySource
to ensure immutability.Example Usage
// Configure a Spring Environment to use this factory for loading YAML resources ConfigurableEnvironment environment = context.getEnvironment(); environment.setPropertySources(new YamlPropertySourceFactory().createPropertySource("my-config", encodedResource));
For more information on how YAML resources are processed, see
ResourceYamlProcessor
.- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
YamlPropertySource
,PropertySourceFactory
,PropertySource
,ResourceYamlProcessor
,ImmutableMapPropertySource
-
-
Constructor Summary
Constructors Constructor Description YamlPropertySourceFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.core.env.PropertySource<?>
createPropertySource(java.lang.String name, org.springframework.core.io.support.EncodedResource resource)
-
-
-
Method Detail
-
createPropertySource
public org.springframework.core.env.PropertySource<?> createPropertySource(java.lang.String name, org.springframework.core.io.support.EncodedResource resource) throws java.io.IOException
- Specified by:
createPropertySource
in interfaceorg.springframework.core.io.support.PropertySourceFactory
- Throws:
java.io.IOException
-
-