Example usage for org.springframework.boot.context.properties.bind Bindable ofInstance

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

Introduction

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

Prototype

@SuppressWarnings("unchecked")
public static <T> Bindable<T> ofInstance(T instance) 

Source Link

Document

Create a new Bindable of the type of the specified instance with an existing value equal to the instance.

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