Search in sources :

Example 1 with PropertySourcesPropertyValues

use of org.springframework.boot.bind.PropertySourcesPropertyValues in project spring-boot by spring-projects.

the class SpringProfileDocumentMatcher method extractSpringProfiles.

protected List<String> extractSpringProfiles(Properties properties) {
    SpringProperties springProperties = new SpringProperties();
    MutablePropertySources propertySources = new MutablePropertySources();
    propertySources.addFirst(new PropertiesPropertySource("profiles", properties));
    PropertyValues propertyValues = new PropertySourcesPropertyValues(propertySources);
    new RelaxedDataBinder(springProperties, "spring").bind(propertyValues);
    List<String> profiles = springProperties.getProfiles();
    return profiles;
}
Also used : PropertySourcesPropertyValues(org.springframework.boot.bind.PropertySourcesPropertyValues) PropertyValues(org.springframework.beans.PropertyValues) PropertiesPropertySource(org.springframework.core.env.PropertiesPropertySource) RelaxedDataBinder(org.springframework.boot.bind.RelaxedDataBinder) MutablePropertySources(org.springframework.core.env.MutablePropertySources) PropertySourcesPropertyValues(org.springframework.boot.bind.PropertySourcesPropertyValues)

Example 2 with PropertySourcesPropertyValues

use of org.springframework.boot.bind.PropertySourcesPropertyValues in project spring-boot by spring-projects.

the class MustacheEnvironmentCollector method setEnvironment.

@Override
public void setEnvironment(Environment environment) {
    this.environment = (ConfigurableEnvironment) environment;
    this.target = new HashMap<>();
    new RelaxedDataBinder(this.target).bind(new PropertySourcesPropertyValues(this.environment.getPropertySources()));
    this.propertyResolver = new RelaxedPropertyResolver(environment);
}
Also used : RelaxedDataBinder(org.springframework.boot.bind.RelaxedDataBinder) RelaxedPropertyResolver(org.springframework.boot.bind.RelaxedPropertyResolver) PropertySourcesPropertyValues(org.springframework.boot.bind.PropertySourcesPropertyValues)

Aggregations

PropertySourcesPropertyValues (org.springframework.boot.bind.PropertySourcesPropertyValues)2 RelaxedDataBinder (org.springframework.boot.bind.RelaxedDataBinder)2 PropertyValues (org.springframework.beans.PropertyValues)1 RelaxedPropertyResolver (org.springframework.boot.bind.RelaxedPropertyResolver)1 MutablePropertySources (org.springframework.core.env.MutablePropertySources)1 PropertiesPropertySource (org.springframework.core.env.PropertiesPropertySource)1