Skip to content

Commit

Permalink
Polish : apache#319
Browse files Browse the repository at this point in the history
  • Loading branch information
mercyblitz committed Dec 18, 2018
1 parent 49c1377 commit f55886d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
import com.alibaba.dubbo.config.AbstractConfig;
import com.alibaba.dubbo.config.spring.context.properties.AbstractDubboConfigBinder;
import com.alibaba.dubbo.config.spring.context.properties.DubboConfigBinder;

import org.springframework.boot.context.properties.bind.BindHandler;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.boot.context.properties.bind.PropertySourcesPlaceholdersResolver;
import org.springframework.boot.context.properties.bind.handler.IgnoreErrorsBindHandler;
import org.springframework.boot.context.properties.bind.handler.NoUnboundElementsBindHandler;
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
import org.springframework.boot.context.properties.source.UnboundElementsSourceFilter;
import org.springframework.core.env.PropertySource;

import static org.springframework.boot.context.properties.source.ConfigurationPropertySources.from;

Expand All @@ -41,13 +44,15 @@ public class RelaxedDubboConfigBinder extends AbstractDubboConfigBinder {
@Override
public <C extends AbstractConfig> void bind(String prefix, C dubboConfig) {

Iterable<PropertySource<?>> propertySources = getPropertySources();

// Converts ConfigurationPropertySources
Iterable<ConfigurationPropertySource> propertySources = from(getPropertySources());
Iterable<ConfigurationPropertySource> configurationPropertySources = from(propertySources);

// Wrap Bindable from DubboConfig instance
Bindable<C> bindable = Bindable.ofInstance(dubboConfig);

Binder binder = new Binder(propertySources);
Binder binder = new Binder(configurationPropertySources, new PropertySourcesPlaceholdersResolver(propertySources));

// Get BindHandler
BindHandler bindHandler = getBindHandler();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ management:

dubbo:
application:
id: ${spring.application.name}
logger: slf4j
protocol:
id: dubbo
Expand Down

0 comments on commit f55886d

Please sign in to comment.