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);
}
}
转载于:https://www.cnblogs.com/sidesky/p/10536800.html
最后
以上就是威武野狼最近收集整理的关于基于spring的PropertySource类实现配置的动态替换的全部内容,更多相关基于spring内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复