mirror of
https://gitee.com/zhijiantianya/ruoyi-vue-pro.git
synced 2026-03-22 05:07:17 +08:00
fix: 【framework】添加 originalConfig 字段以保存原始文件配置,修复配置变更判断逻辑
This commit is contained in:
@@ -19,10 +19,18 @@ public abstract class AbstractFileClient<Config extends FileClientConfig> implem
|
||||
* 文件配置
|
||||
*/
|
||||
protected Config config;
|
||||
/**
|
||||
* 原始的文件配置
|
||||
*
|
||||
* 原因:{@link #config} 可能被子类所修改,无法用于判断配置是否变更
|
||||
* @link <a href="https://t.zsxq.com/29wkW">相关案例</a>
|
||||
*/
|
||||
private Config originalConfig;
|
||||
|
||||
public AbstractFileClient(Long id, Config config) {
|
||||
this.id = id;
|
||||
this.config = config;
|
||||
this.originalConfig = config;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,11 +48,12 @@ public abstract class AbstractFileClient<Config extends FileClientConfig> implem
|
||||
|
||||
public final void refresh(Config config) {
|
||||
// 判断是否更新
|
||||
if (config.equals(this.config)) {
|
||||
if (config.equals(this.originalConfig)) {
|
||||
return;
|
||||
}
|
||||
log.info("[refresh][配置({})发生变化,重新初始化]", config);
|
||||
this.config = config;
|
||||
this.originalConfig = config;
|
||||
// 初始化
|
||||
this.init();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user