Example usage for org.springframework.boot.context.properties.source MapConfigurationPropertySource MapConfigurationPropertySource

List of usage examples for org.springframework.boot.context.properties.source MapConfigurationPropertySource MapConfigurationPropertySource

Introduction

In this page you can find the example usage for org.springframework.boot.context.properties.source MapConfigurationPropertySource MapConfigurationPropertySource.

Prototype

public MapConfigurationPropertySource(Map<?, ?> map) 

Source Link

Document

Create a new MapConfigurationPropertySource instance with entries copies from the specified map.

Usage

From source file:io.spring.initializr.metadata.InitializrMetadataBuilderTests.java

private static InitializrProperties load(Resource resource) {
    ConfigurationPropertySource source = new MapConfigurationPropertySource(loadProperties(resource));
    Binder binder = new Binder(source);
    return binder.bind("initializr", InitializrProperties.class).get();
}

From source file:org.springframework.boot.jdbc.DataSourceBuilder.java

private void bind(DataSource result) {
    ConfigurationPropertySource source = new MapConfigurationPropertySource(this.properties);
    ConfigurationPropertyNameAliases aliases = new ConfigurationPropertyNameAliases();
    aliases.addAliases("url", "jdbc-url");
    aliases.addAliases("username", "user");
    Binder binder = new Binder(source.withAliases(aliases));
    binder.bind(ConfigurationPropertyName.EMPTY, Bindable.ofInstance(result));
}