Example usage for org.springframework.boot.context.properties.source ConfigurationPropertySource withAliases

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

Introduction

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

Prototype

default ConfigurationPropertySource withAliases(ConfigurationPropertyNameAliases aliases) 

Source Link

Document

Return a variant of this source that supports name aliases.

Usage

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