use of com.alibaba.cloud.nacos.NacosConfigProperties in project muses by acgist.
the class MusesConfigBuilder method build.
/**
* 创建系统配置
*
* @return
*/
public MusesConfig build() {
final ConfigService configService = this.nacosConfigManager.getConfigService();
final NacosConfigProperties nacosConfigProperties = this.nacosConfigManager.getNacosConfigProperties();
try {
// 保存配置中心
configService.publishConfig(MusesConfig.MUSES_CONFIG, nacosConfigProperties.getGroup(), JSONUtils.toJSON(this.musesConfig));
} catch (NacosException e) {
log.error("设置系统配置异常", e);
}
return this.musesConfig;
}
use of com.alibaba.cloud.nacos.NacosConfigProperties in project muses by acgist.
the class MusesConfigBuilder method init.
/**
* 初始系统配置
*
* @param nacosConfigManager NacosConfigManager
*
* @return this
*/
private MusesConfigBuilder init() {
final ConfigService configService = this.nacosConfigManager.getConfigService();
final NacosConfigProperties nacosConfigProperties = this.nacosConfigManager.getNacosConfigProperties();
try {
final String oldConfig = configService.getConfig(MusesConfig.MUSES_CONFIG, nacosConfigProperties.getGroup(), MusesConfig.TIMEOUT);
if (StringUtils.isEmpty(oldConfig)) {
this.musesConfig = new MusesConfig();
} else {
this.musesConfig = JSONUtils.toJava(oldConfig, MusesConfig.class);
}
} catch (NacosException e) {
log.error("初始系统配置异常", e);
}
return this;
}
Aggregations