This commit is contained in:
2025-12-31 12:15:21 +08:00
parent c72bb3270d
commit 5d4636ccc8
7 changed files with 22 additions and 42 deletions

View File

@@ -1,11 +1,7 @@
package link.at17.mid.tushare.interfaces;
import java.util.Objects;
import org.springframework.stereotype.Component;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import jakarta.annotation.PostConstruct;
import link.at17.mid.tushare.service.ConfigService;
import link.at17.mid.tushare.system.util.SpringContextHolder;
@@ -40,32 +36,6 @@ public interface IConfig<T extends IConfig<T>> {
return (T) this;
}
/**
* 合并到 other且返回合并后的 other
* @return
*/
public default T mergeTo(T other) {
if (!Objects.equals(this, other)) {
BeanUtil.copyProperties(this, other,
CopyOptions.create().setIgnoreNullValue(true));
}
return other;
}
/**
* 合并其他,并返回本身
* @param other
* @return
*/
@SuppressWarnings("unchecked")
public default T mergeFrom(T other) {
if (!Objects.equals(this, other)) {
BeanUtil.copyProperties(other, this,
CopyOptions.create().setIgnoreNullValue(true));
}
return (T) this;
}
/**
* 初始化完成之后的方法,会在
* <code><i>beanFactory</i>.autowireBean(bean)</code>