概述
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的PropertySource类实现配置的动态替换所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复