Search in sources :

Example 6 with YamlPropertySourceLoader

use of org.springframework.boot.env.YamlPropertySourceLoader in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceBrokerPropertiesBindingTest method bindFullValidYaml.

@Test
void bindFullValidYaml() throws Exception {
    this.context.register(ServiceBrokerPropertiesConfiguration.class);
    Resource resource = context.getResource("classpath:catalog-full.yml");
    YamlPropertySourceLoader sourceLoader = new YamlPropertySourceLoader();
    List<PropertySource<?>> properties = sourceLoader.load("catalog", resource);
    context.getEnvironment().getPropertySources().addFirst(properties.get(0));
    validateFullCatalog();
}
Also used : Resource(org.springframework.core.io.Resource) YamlPropertySourceLoader(org.springframework.boot.env.YamlPropertySourceLoader) PropertySource(org.springframework.core.env.PropertySource) Test(org.junit.jupiter.api.Test)

Aggregations

YamlPropertySourceLoader (org.springframework.boot.env.YamlPropertySourceLoader)6 Resource (org.springframework.core.io.Resource)4 Test (org.junit.jupiter.api.Test)3 PropertySource (org.springframework.core.env.PropertySource)3 IOException (java.io.IOException)1 PostConstruct (javax.annotation.PostConstruct)1 Test (org.junit.Test)1 PropertySourceLoader (org.springframework.boot.env.PropertySourceLoader)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1 MapPropertySource (org.springframework.core.env.MapPropertySource)1 MutablePropertySources (org.springframework.core.env.MutablePropertySources)1 StandardEnvironment (org.springframework.core.env.StandardEnvironment)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1 PathMatchingResourcePatternResolver (org.springframework.core.io.support.PathMatchingResourcePatternResolver)1 ResourcePatternResolver (org.springframework.core.io.support.ResourcePatternResolver)1