添加一个刷新数据库的方法,SupplierSqlConfig创建方式改为静态工厂获取实例

This commit is contained in:
wind 2023-04-19 20:39:12 +08:00
parent d5fa888919
commit afd4a0536f
4 changed files with 17 additions and 8 deletions

View File

@ -65,7 +65,7 @@ public class SmsAutowiredConfig {
@Bean
@ConditionalOnProperty(prefix = "sms", name = "config-type", havingValue = "sql_config")
protected void supplierSqlConfig(){
new SupplierSqlConfig();
SupplierSqlConfig.newSupplierSqlConfig();
}
@ -81,7 +81,7 @@ public class SmsAutowiredConfig {
log.debug("SMS restriction is enabled");
}
if (BeanFactory.getSmsConfig().getIsPrint()){
SmsBanner.PrintBanner("V 1.0.5");
SmsBanner.PrintBanner("V 2.0.1");
}
}
}

View File

@ -72,9 +72,4 @@ public class SupplierConfig {
protected EmayConfig emayConfig(){
return SupplierFactory.getEmayConfig();
}
/** 为的是延后执行*/
protected void init(){
}
}

View File

@ -33,7 +33,7 @@ public class SupplierSqlConfig {
* <p>在类初始化是完成方法调用
* @author :Wind
*/
public SupplierSqlConfig() {
private SupplierSqlConfig() {
alibaba();
huawei();
jingdong();
@ -44,6 +44,10 @@ public class SupplierSqlConfig {
emay();
}
public static SupplierSqlConfig newSupplierSqlConfig(){
return new SupplierSqlConfig();
}
/**
* alibaba
* <p>数据库读取并设置阿里云短信

View File

@ -1,5 +1,6 @@
package org.dromara.sms4j.core.factory;
import org.dromara.sms4j.core.SupplierSqlConfig;
import org.dromara.sms4j.emay.config.EmaySmsConfig;
import org.dromara.sms4j.aliyun.config.AlibabaSmsConfig;
import org.dromara.sms4j.api.SmsBlend;
@ -93,4 +94,13 @@ public class SmsFactory {
}
throw new SmsBlendException("An attempt to construct a SmsBlend object failed. Please check that the enumeration is valid");
}
/**
* refreshSqlConfig
* <p>重新读取sql配置
* @author :Wind
*/
public static void refreshSqlConfig() {
SupplierSqlConfig.newSupplierSqlConfig();
}
}