Search in sources :

Example 1 with PropertySourcesPlaceholdersResolver

use of org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver in project spring-cloud-stream by spring-cloud.

the class EnvironmentEntryInitializingTreeMap method put.

@Override
public T put(String key, T value) {
    // boot 2 call this first
    Binder binder = new Binder(ConfigurationPropertySources.get(environment), new PropertySourcesPlaceholdersResolver(environment), this.conversionService, null);
    binder.bind(defaultsPrefix, Bindable.ofInstance(value));
    return this.delegate.put(key, value);
}
Also used : Binder(org.springframework.boot.context.properties.bind.Binder) PropertySourcesPlaceholdersResolver(org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver)

Example 2 with PropertySourcesPlaceholdersResolver

use of org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver in project spring-cloud-stream by spring-cloud.

the class EnvironmentEntryInitializingTreeMap method get.

@Override
public T get(Object key) {
    if (!this.delegate.containsKey(key) && key instanceof String) {
        T entry = BeanUtils.instantiateClass(entryClass);
        Binder binder = new Binder(ConfigurationPropertySources.get(environment), new PropertySourcesPlaceholdersResolver(environment), this.conversionService, null);
        binder.bind(defaultsPrefix, Bindable.ofInstance(entry));
        this.delegate.put((String) key, entry);
    }
    return this.delegate.get(key);
}
Also used : Binder(org.springframework.boot.context.properties.bind.Binder) PropertySourcesPlaceholdersResolver(org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver)

Aggregations

Binder (org.springframework.boot.context.properties.bind.Binder)2 PropertySourcesPlaceholdersResolver (org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver)2