public class ConfigPropertySource extends PropertySource<Properties> implements PriorityOrdered, BeanFactoryPostProcessor, EnvironmentAware{

public void init() {
this.loadConfig();
this.env.getPropertySources().addFirst(this);
}

private Properties parseConfig(String config) {
Properties properties = new Properties();
if(StringUtils.isNotEmpty(config)) {
try {
properties.load(new StringReader(config));
} catch (Exception var4) {
throw new IllegalArgumentException("detail center parse config error, config:" + config, var4);
}
}

return properties;
}

public Object getProperty(String name) {
return this.source.get(name);
}

}

posted on 2019-03-15 14:20  sidesky  阅读(2004)  评论(0编辑  收藏  举报