【7.6.0】【框架改造】【config】简化依赖

pull/55/head
fengshuonan 2023-05-09 11:10:56 +08:00
parent 8bc09638cf
commit ee75b50774
6 changed files with 24 additions and 31 deletions

View File

@ -102,4 +102,9 @@ public interface RuleConstants {
*/ */
int DEFAULT_BATCH_INSERT_SIZE = 100; int DEFAULT_BATCH_INSERT_SIZE = 100;
/**
* SYS_SERVER_DEPLOY_HOST
*/
String DEFAULT_SERVER_DEPLOY_HOST = "http://localhost:8080";
} }

View File

@ -17,28 +17,6 @@
<dependencies> <dependencies>
<!--文件api-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>file-api</artifactId>
<version>${roses.version}</version>
</dependency>
<!--系统配置表的redis的sdk-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>config-sdk-redis</artifactId>
<version>${roses.version}</version>
<optional>true</optional>
</dependency>
<!--默认系统配置表的sdk-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>config-sdk-map</artifactId>
<version>${roses.version}</version>
</dependency>
<!--资源api模块--> <!--资源api模块-->
<!--用在资源控制器,资源扫描上--> <!--用在资源控制器,资源扫描上-->
<dependency> <dependency>
@ -55,6 +33,21 @@
<version>${roses.version}</version> <version>${roses.version}</version>
</dependency> </dependency>
<!--系统配置表的缓存使用redis还是mapRedis用在将系统部署在分布式环境-->
<!--默认使用Map如果分布式环境则在项目依赖中切换-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>config-sdk-map</artifactId>
<version>${roses.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>config-sdk-redis</artifactId>
<version>${roses.version}</version>
<optional>true</optional>
</dependency>
<!--数据库sdk--> <!--数据库sdk-->
<!--数据库dao框架--> <!--数据库dao框架-->
<dependency> <dependency>

View File

@ -117,7 +117,7 @@ public class ConfigInitListener extends ContextInitializedListener implements Or
entityList.forEach(sysConfig -> ConfigContext.me().putConfig(sysConfig.getStr("config_code"), sysConfig.getStr("config_value"))); entityList.forEach(sysConfig -> ConfigContext.me().putConfig(sysConfig.getStr("config_code"), sysConfig.getStr("config_value")));
} }
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
log.error("初始化系统配置表失败,找不到{}类 : {}", driverClassName, e); log.error("初始化系统配置表失败,找不到{}类 : {}", driverClassName, driverClassName);
throw new ConfigException(ConfigExceptionEnum.CLASS_NOT_FOUND_ERROR); throw new ConfigException(ConfigExceptionEnum.CLASS_NOT_FOUND_ERROR);
} catch (SQLException sqlException) { } catch (SQLException sqlException) {
log.error("初始化系统配置表失败,执行查询语句失败", sqlException); log.error("初始化系统配置表失败,执行查询语句失败", sqlException);

View File

@ -46,7 +46,6 @@ import cn.stylefeng.roses.kernel.config.modular.service.SysConfigService;
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory; 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.factory.PageResultFactory;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult; 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.callback.ConfigUpdateCallback;
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants; import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
import cn.stylefeng.roses.kernel.rule.enums.StatusEnum; import cn.stylefeng.roses.kernel.rule.enums.StatusEnum;
@ -267,7 +266,7 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
if (sysConfig != null) { if (sysConfig != null) {
return sysConfig.getConfigValue(); return sysConfig.getConfigValue();
} else { } else {
return FileConstants.DEFAULT_SERVER_DEPLOY_HOST; return RuleConstants.DEFAULT_SERVER_DEPLOY_HOST;
} }
} }

View File

@ -52,11 +52,6 @@ public interface FileConstants {
*/ */
String DEFAULT_BUCKET_NAME = "defaultBucket"; String DEFAULT_BUCKET_NAME = "defaultBucket";
/**
* SYS_SERVER_DEPLOY_HOST
*/
String DEFAULT_SERVER_DEPLOY_HOST = "http://localhost:8080";
/** /**
* *
*/ */

View File

@ -28,6 +28,7 @@ import cn.hutool.core.util.RandomUtil;
import cn.stylefeng.roses.kernel.config.api.context.ConfigContext; import cn.stylefeng.roses.kernel.config.api.context.ConfigContext;
import cn.stylefeng.roses.kernel.file.api.constants.FileConstants; import cn.stylefeng.roses.kernel.file.api.constants.FileConstants;
import cn.stylefeng.roses.kernel.file.api.pojo.props.LocalFileProperties; import cn.stylefeng.roses.kernel.file.api.pojo.props.LocalFileProperties;
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
/** /**
* *
@ -56,7 +57,7 @@ public class FileConfigExpander {
* @since 2020/11/29 16:13 * @since 2020/11/29 16:13
*/ */
public static String getServerDeployHost() { public static String getServerDeployHost() {
return ConfigContext.me().getSysConfigValueWithDefault("SYS_SERVER_DEPLOY_HOST", String.class, FileConstants.DEFAULT_SERVER_DEPLOY_HOST); return ConfigContext.me().getSysConfigValueWithDefault("SYS_SERVER_DEPLOY_HOST", String.class, RuleConstants.DEFAULT_SERVER_DEPLOY_HOST);
} }
/** /**