mirror of https://gitee.com/stylefeng/roses
【7.3.0】增加配置修改的回调事件
parent
8f87e6ac9c
commit
511ac5680c
|
@ -0,0 +1,21 @@
|
|||
package cn.stylefeng.roses.kernel.rule.callback;
|
||||
|
||||
/**
|
||||
* 系统配置修改的回调事件
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/10/22 21:35
|
||||
*/
|
||||
public interface ConfigUpdateCallback {
|
||||
|
||||
/**
|
||||
* 系统配置修改的回调事件
|
||||
*
|
||||
* @param code 系统配置的编码,例如:SYS_SERVER_DEPLOY_HOST
|
||||
* @param value 新修改的配置值
|
||||
* @author fengshuonan
|
||||
* @date 2022/10/22 21:36
|
||||
*/
|
||||
void configUpdate(String code, String value);
|
||||
|
||||
}
|
|
@ -45,6 +45,7 @@ import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
|||
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
|
||||
import cn.stylefeng.roses.kernel.rule.callback.ConfigUpdateCallback;
|
||||
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
|
||||
import cn.stylefeng.roses.kernel.rule.enums.StatusEnum;
|
||||
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
||||
|
@ -125,6 +126,16 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
|
|||
|
||||
// 4.更新对应常量context
|
||||
ConfigContext.me().putConfig(sysConfigParam.getConfigCode(), sysConfigParam.getConfigValue());
|
||||
|
||||
// 5.发布属性修改的事件
|
||||
try {
|
||||
Map<String, ConfigUpdateCallback> beansOfType = SpringUtil.getBeansOfType(ConfigUpdateCallback.class);
|
||||
for (ConfigUpdateCallback value : beansOfType.values()) {
|
||||
value.configUpdate(sysConfig.getConfigCode(), sysConfig.getConfigValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 忽略找不到Bean的异常
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue