package link.at17.mid.tushare.interfaces; import org.springframework.stereotype.Component; import jakarta.annotation.PostConstruct; import link.at17.mid.tushare.service.ConfigService; import link.at17.mid.tushare.system.util.SpringContextHolder; /** * 配置项必须实现该接口 * * @author Doghole * */ @Component public interface IConfig> { @SuppressWarnings("unchecked") public default boolean saveOrUpdate() { return SpringContextHolder.getBean(ConfigService.class).saveOrUpdate((T)this); } /** * 保存前处理。无论 @ConfigInfo 是否设置 save = true 都会调用 */ @SuppressWarnings("unchecked") public default T afterSaving() { return (T) this; } /** * 保存后处理。无论 @ConfigInfo 是否设置 save = true 都会调用 */ @SuppressWarnings("unchecked") public default T beforeSaving() { return (T) this; } /** * 初始化完成之后的方法,会在 * beanFactory.autowireBean(bean) * 和 * beanFactory.initializeBean(bean, beanName) * 后执行。
* @see quant.rich.emoney.config.ConfigServiceFactoryBean */ @PostConstruct public default void afterBeanInit() {} public static class Views { public static class Persistence {} } }