Example usage for org.springframework.boot.context.properties.bind Binder Binder

List of usage examples for org.springframework.boot.context.properties.bind Binder Binder

Introduction

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

Prototype

public Binder(Iterable<ConfigurationPropertySource> sources) 

Source Link

Document

Create a new Binder instance for the specified sources.

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));
}