schema = getSchema(clazz);
+ ProtostuffIOUtil.mergeFrom(data, obj, schema);
+ return obj;
+ } catch (Exception e) {
+ throw new IllegalStateException(e.getMessage(), e);
}
+ }
- public static void main(String[] args) {
- byte[] userBytes = ProtostuffUtil.serializer(new ConfigFileInfo());
- ConfigFileInfo user = ProtostuffUtil.deserializer(userBytes, ConfigFileInfo.class);
- System.out.println(user);
- }
-}
\ No newline at end of file
+ public static void main(String[] args) {
+ byte[] userBytes = ProtostuffUtil.serializer(new ConfigFileInfo());
+ ConfigFileInfo user = ProtostuffUtil.deserializer(userBytes, ConfigFileInfo.class);
+ System.out.println(user);
+ }
+}
diff --git a/kenaito-config-core/src/main/java/cn/odboy/config/context/ClientConfigLoader.java b/kenaito-config-core/src/main/java/cn/odboy/config/context/ClientConfigLoader.java
index c7a39bc..9489d99 100644
--- a/kenaito-config-core/src/main/java/cn/odboy/config/context/ClientConfigLoader.java
+++ b/kenaito-config-core/src/main/java/cn/odboy/config/context/ClientConfigLoader.java
@@ -117,9 +117,7 @@ public class ClientConfigLoader {
ClientConfigConsts.clientInfo.wait();
} catch (InterruptedException e) {
Thread currentThread = Thread.currentThread();
- String currentThreadName = currentThread.getName();
currentThread.interrupt();
- logger.error("中断线程: {}", currentThreadName, e);
}
}
// 判断配置中心服务是否处于离线状态
@@ -175,32 +173,48 @@ public class ClientConfigLoader {
};
}
+ /**
+ * 初始化客户端信息
+ *
+ * @param defaultCacheDir 默认缓存目录如果环境变量中未指定缓存目录,则使用此默认值
+ * @param environment 应用程序环境变量用于从中获取配置信息
+ */
private static void initClientInfo(String defaultCacheDir, ConfigurableEnvironment environment) {
+ // 设置服务器地址
ClientConfigConsts.clientInfo.setServer(
environment.getProperty(
ClientConfigConsts.DEFAULT_CONFIG_NAME_SERVER,
String.class,
ClientConfigConsts.DEFAULT_CONFIG_SERVER));
+ // 设置端口
ClientConfigConsts.clientInfo.setPort(
environment.getProperty(
ClientConfigConsts.DEFAULT_CONFIG_NAME_PORT,
Integer.class,
ClientConfigConsts.DEFAULT_CONFIG_PORT));
+ // 设置环境
ClientConfigConsts.clientInfo.setEnv(
environment.getProperty(
ClientConfigConsts.DEFAULT_CONFIG_NAME_ENV,
String.class,
ClientConfigConsts.DEFAULT_CONFIG_ENV));
+ // 设置数据ID
ClientConfigConsts.clientInfo.setDataId(
environment.getProperty(
ClientConfigConsts.DEFAULT_CONFIG_NAME_DATA_ID,
String.class,
ClientConfigConsts.DEFAULT_CONFIG_DATA_ID));
+ // 设置缓存目录
ClientConfigConsts.clientInfo.setCacheDir(
environment.getProperty(
ClientConfigConsts.DEFAULT_CONFIG_NAME_CACHE_DIR, String.class, defaultCacheDir));
}
+ /**
+ * 获取默认的缓存目录路径 根据操作系统类型返回对应的缓存目录路径
+ *
+ * @return 默认的缓存目录路径
+ */
private static String getDefaultCacheDir() {
String defaultCacheDir;
String os = System.getProperty("os.name");
@@ -209,16 +223,25 @@ public class ClientConfigLoader {
} else if (os.toLowerCase().startsWith(ClientConfigConsts.OS_TYPE_MAC)) {
defaultCacheDir = ClientConfigConsts.DEFAULT_PATH_MAC;
} else {
+ // 对于未知操作系统,默认使用Mac操作系统的缓存路径
defaultCacheDir = ClientConfigConsts.DEFAULT_PATH_MAC;
}
return defaultCacheDir;
}
+ /**
+ * 验证缓存目录路径的合法性 确保提供的缓存路径与默认路径格式相符,防止路径配置错误
+ *
+ * @param defaultCacheDir 默认的缓存目录路径
+ * @param cacheDir 用户配置的缓存目录路径
+ */
private static void validateCacheDirPath(String defaultCacheDir, String cacheDir) {
+ // 检查是否为Windows系统默认路径格式,且用户配置的路径是否符合该格式
if (defaultCacheDir.contains(ClientConfigConsts.DEFAULT_PATH_WIN_SEP)
&& !cacheDir.contains(ClientConfigConsts.DEFAULT_PATH_WIN_SEP)) {
throw new RuntimeException(ClientConfigConsts.DEFAULT_CONFIG_NAME_CACHE_DIR + " 配置的路径不正确");
}
+ // 检查用户配置的路径是否包含Windows系统路径分隔符,且是否正确使用
if (cacheDir.contains(ClientConfigConsts.DEFAULT_PATH_WIN_SEP)
&& !cacheDir.contains(ClientConfigConsts.DEFAULT_PATH_SEP_WIN)) {
throw new RuntimeException(
@@ -228,11 +251,20 @@ public class ClientConfigLoader {
}
}
- /** 创建缓存文件夹 */
+ /**
+ * 创建缓存目录 如果目录不存在,将尝试创建它并检查写权限
+ *
+ * @param cacheDir 缓存目录的路径
+ * @throws RuntimeException 如果目录创建失败或没有写权限
+ */
private static void createCacheDir(String cacheDir) {
+ // 获取缓存目录的路径对象
Path path = Paths.get(cacheDir);
+ // 检查缓存目录是否存在,如果不存在则尝试创建
if (!Files.exists(path)) {
+ // 使用FileUtil工具类创建目录
File mkdir = FileUtil.mkdir(cacheDir);
+ // 检查创建后的目录是否可写,如果不可写则抛出异常
if (!mkdir.canWrite()) {
throw new RuntimeException("缓存文件夹创建失败, 无读写权限");
}
diff --git a/kenaito-config-core/src/main/java/cn/odboy/config/context/ClientPropertyHelper.java b/kenaito-config-core/src/main/java/cn/odboy/config/context/ClientPropertyHelper.java
new file mode 100644
index 0000000..1d85b8d
--- /dev/null
+++ b/kenaito-config-core/src/main/java/cn/odboy/config/context/ClientPropertyHelper.java
@@ -0,0 +1,84 @@
+package cn.odboy.config.context;
+
+import cn.hutool.core.util.StrUtil;
+import cn.odboy.config.constant.ClientConfigConsts;
+import cn.odboy.config.constant.ClientConfigVars;
+import java.util.Map;
+import lombok.RequiredArgsConstructor;
+import org.springframework.core.env.ConfigurableEnvironment;
+import org.springframework.core.env.MapPropertySource;
+import org.springframework.core.env.MutablePropertySources;
+import org.springframework.core.env.PropertySource;
+import org.springframework.stereotype.Component;
+
+/**
+ * 客户端配置 辅助类
+ *
+ * 依赖 spring-cloud-context
+ *
+ * @author odboy
+ * @date 2024-12-07
+ */
+@Component
+@RequiredArgsConstructor
+public class ClientPropertyHelper {
+ private final ConfigurableEnvironment environment;
+ private final ValueAnnotationProcessor valueAnnotationProcessor;
+ // private final ConfigDataContextRefresher configDataContextRefresher;
+ private final ConfigPropertyContextRefresher contextRefresher;
+
+ /**
+ * 动态更新配置值
+ *
+ * @param propertyName 属性路径名
+ * @param value 属性值
+ */
+ public void updateValue(String propertyName, Object value) {
+ if (StrUtil.isNotBlank(propertyName)) {
+ // 设置属性值
+ MutablePropertySources propertySources = environment.getPropertySources();
+ if (propertySources.contains(ClientConfigConsts.PROPERTY_SOURCE_NAME)) {
+ // 更新属性值
+ PropertySource> propertySource =
+ propertySources.get(ClientConfigConsts.PROPERTY_SOURCE_NAME);
+ Map source = ((MapPropertySource) propertySource).getSource();
+ source.put(propertyName, value);
+ }
+ // 单独更新@Value对应的值
+ valueAnnotationProcessor.setValue(propertyName, value);
+ // 刷新上下文(解决 @ConfigurationProperties注解的类属性值更新 问题)
+ // Spring Cloud只会对被@RefreshScope和@ConfigurationProperties标注的bean进行刷新
+ // 这个方法主要做了两件事:刷新配置源,也就是PropertySource,然后刷新了@ConfigurationProperties注解的类
+ // configDataContextRefresher.refresh();
+ contextRefresher.refreshAll();
+ }
+ }
+
+ /**
+ * 更新所有配置属性
+ * 此方法遍历缓存的配置,更新应用程序中的相应属性
+ * 它主要针对的是那些使用@Value注解注入的配置属性
+ * 当缓存的配置发生变化时,通过此方法可以确保应用中的配置是最新的
+ */
+ public void updateAll() {
+ // 获取所有可变属性源
+ MutablePropertySources propertySources = environment.getPropertySources();
+ // 检查是否包含特定的属性源
+ if (propertySources.contains(ClientConfigConsts.PROPERTY_SOURCE_NAME)) {
+ // 获取属性源
+ PropertySource> propertySource =
+ propertySources.get(ClientConfigConsts.PROPERTY_SOURCE_NAME);
+ // 将属性源转换为Map形式,以便于更新属性
+ Map source = ((MapPropertySource) propertySource).getSource();
+ // 遍历缓存的配置
+ for (Map.Entry kvMap : ClientConfigVars.cacheConfigs.entrySet()) {
+ // 更新属性值
+ source.put(kvMap.getKey(), kvMap.getValue());
+ // 单独更新@Value对应的值
+ valueAnnotationProcessor.setValue(kvMap.getKey(), kvMap.getValue());
+ }
+ // 刷新所有应用上下文,使更新后的配置生效
+ contextRefresher.refreshAll();
+ }
+ }
+}
diff --git a/kenaito-config-core/src/main/java/cn/odboy/config/context/ClientPropertyRefresher.java b/kenaito-config-core/src/main/java/cn/odboy/config/context/ClientPropertyRefresher.java
deleted file mode 100644
index 34664a8..0000000
--- a/kenaito-config-core/src/main/java/cn/odboy/config/context/ClientPropertyRefresher.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package cn.odboy.config.context;
-
-import cn.hutool.core.util.StrUtil;
-import cn.odboy.config.constant.ClientConfigConsts;
-import cn.odboy.config.constant.ClientConfigVars;
-import lombok.RequiredArgsConstructor;
-import org.springframework.core.env.ConfigurableEnvironment;
-import org.springframework.core.env.MapPropertySource;
-import org.springframework.core.env.MutablePropertySources;
-import org.springframework.core.env.PropertySource;
-import org.springframework.stereotype.Component;
-
-import java.util.Map;
-
-/**
- * 客户端配置 辅助类
- *
- * 依赖 spring-cloud-context
- *
- * @author odboy
- * @date 2024-12-07
- */
-@Component
-@RequiredArgsConstructor
-public class ClientPropertyRefresher {
- private final ConfigurableEnvironment environment;
- private final ValueAnnotationProcessor valueAnnotationProcessor;
- // private final ConfigDataContextRefresher configDataContextRefresher;
- private final ConfigPropertyContextRefresher contextRefresher;
-
- /**
- * 动态更新配置值
- *
- * @param propertyName 属性路径名
- * @param value 属性值
- */
- public void updateValue(String propertyName, Object value) {
- if (StrUtil.isNotBlank(propertyName)) {
- // 设置属性值
- MutablePropertySources propertySources = environment.getPropertySources();
- if (propertySources.contains(ClientConfigConsts.PROPERTY_SOURCE_NAME)) {
- // 更新属性值
- PropertySource> propertySource = propertySources.get(ClientConfigConsts.PROPERTY_SOURCE_NAME);
- Map source = ((MapPropertySource) propertySource).getSource();
- source.put(propertyName, value);
- }
- // 单独更新@Value对应的值
- valueAnnotationProcessor.setValue(propertyName, value);
- // 刷新上下文(解决 @ConfigurationProperties注解的类属性值更新 问题)
- // Spring Cloud只会对被@RefreshScope和@ConfigurationProperties标注的bean进行刷新
- // 这个方法主要做了两件事:刷新配置源,也就是PropertySource,然后刷新了@ConfigurationProperties注解的类
-// configDataContextRefresher.refresh();
- contextRefresher.refreshAll();
- }
- }
-
- public void updateAll() {
- // 设置属性值
- MutablePropertySources propertySources = environment.getPropertySources();
- if (propertySources.contains(ClientConfigConsts.PROPERTY_SOURCE_NAME)) {
- // 更新属性值
- PropertySource> propertySource = propertySources.get(ClientConfigConsts.PROPERTY_SOURCE_NAME);
- Map source = ((MapPropertySource) propertySource).getSource();
- for (Map.Entry kvMap : ClientConfigVars.cacheConfigs.entrySet()) {
- source.put(kvMap.getKey(), kvMap.getValue());
- // 单独更新@Value对应的值
- valueAnnotationProcessor.setValue(kvMap.getKey(), kvMap.getValue());
- }
- contextRefresher.refreshAll();
- }
- }
-}
diff --git a/kenaito-config-demo/src/main/java/cn/odboy/rest/DemoController.java b/kenaito-config-demo/src/main/java/cn/odboy/rest/DemoController.java
index 0bcc453..430d2d8 100644
--- a/kenaito-config-demo/src/main/java/cn/odboy/rest/DemoController.java
+++ b/kenaito-config-demo/src/main/java/cn/odboy/rest/DemoController.java
@@ -1,6 +1,6 @@
package cn.odboy.rest;
-import cn.odboy.config.context.ClientPropertyRefresher;
+import cn.odboy.config.context.ClientPropertyHelper;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
@@ -21,7 +21,7 @@ public class DemoController {
@Value("${kenaito.config-center.test}")
private String testStr;
private final ConfigCenterProperties configCenterProperties;
- private final ClientPropertyRefresher clientPropertyRefresher;
+ private final ClientPropertyHelper clientPropertyHelper;
/** 配置变化了 */
@GetMapping("/test")
@@ -29,7 +29,7 @@ public class DemoController {
String propertyName = "kenaito.config-center.test";
System.err.println("@Value注解的值1=" + testStr);
System.err.println("@ConfigurationProperties注解的值1=" + configCenterProperties.getTest());
- clientPropertyRefresher.updateValue(propertyName, "Hello World");
+ clientPropertyHelper.updateValue(propertyName, "Hello World");
System.err.println("@Value注解的值2=" + testStr);
System.err.println("@ConfigurationProperties注解的值2=" + configCenterProperties.getTest());
return ResponseEntity.ok("success");
diff --git a/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigApp.java b/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigApp.java
index 5f7b002..dcf346a 100644
--- a/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigApp.java
+++ b/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigApp.java
@@ -65,9 +65,9 @@ public class ConfigApp extends MyNormalEntity {
@Data
public static class QueryClientArgs {
@NotBlank(message = "必填")
- private String env;
+ private String envCode;
@NotBlank(message = "必填")
- private String dataId;
+ private String appName;
}
@Data
diff --git a/kenaito-config-service/src/main/java/cn/odboy/infra/netty/ConfigClientManage.java b/kenaito-config-service/src/main/java/cn/odboy/infra/netty/ConfigClientManage.java
index 381803f..d2c286d 100644
--- a/kenaito-config-service/src/main/java/cn/odboy/infra/netty/ConfigClientManage.java
+++ b/kenaito-config-service/src/main/java/cn/odboy/infra/netty/ConfigClientManage.java
@@ -6,13 +6,12 @@ import cn.odboy.infra.exception.BadRequestException;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelId;
-import lombok.extern.slf4j.Slf4j;
-
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;
+import lombok.extern.slf4j.Slf4j;
/**
* 客户端管理
@@ -22,110 +21,108 @@ import java.util.stream.Collectors;
*/
@Slf4j
public class ConfigClientManage {
- /**
- * 所有的客户端连接: {env}_{dataId}_{channelId} to ctx
- */
- private static final ConcurrentMap CLIENT = new ConcurrentHashMap<>();
+ /** 所有的客户端连接: {env}_{dataId}_{channelId} to ctx */
+ private static final ConcurrentMap CLIENT = new ConcurrentHashMap<>();
- /**
- * 查询客户端节点列表
- *
- * @param env 环境编码
- * @param dataId 应用名称
- * @return /
- */
- private static List queryClientInfos(String env, String dataId) {
- String filterKey = String.format("%s_%s_", env, dataId);
- return CLIENT.entrySet().stream()
- .filter(f -> f.getKey().startsWith(filterKey))
- .map(Map.Entry::getValue)
- .map(
- m -> {
- ConfigApp.ClientInfo clientInfo = new ConfigApp.ClientInfo();
- clientInfo.setIp(m.remoteAddress().toString().replaceAll("/", ""));
- clientInfo.setIsActive(m.isActive());
- return clientInfo;
- })
- .collect(Collectors.toList());
- }
+ /**
+ * 查询客户端节点列表
+ *
+ * @param envCode 环境编码
+ * @param appName 应用名称
+ * @return /
+ */
+ private static List queryClientInfos(String envCode, String appName) {
+ String filterKey = String.format("%s_%s_", envCode, appName);
+ return CLIENT.entrySet().stream()
+ .filter(f -> f.getKey().startsWith(filterKey))
+ .map(Map.Entry::getValue)
+ .map(
+ m -> {
+ ConfigApp.ClientInfo clientInfo = new ConfigApp.ClientInfo();
+ clientInfo.setIp(m.remoteAddress().toString().replaceAll("/", ""));
+ clientInfo.setIsActive(m.isActive());
+ return clientInfo;
+ })
+ .collect(Collectors.toList());
+ }
- /**
- * 客户端注册
- *
- * @param env 环境编码
- * @param dataId 应用名称
- * @param ctx 信道
- */
- public static void register(String env, String dataId, ChannelHandlerContext ctx) {
- String envClientKey = String.format("%s_%s_%s", env, dataId, ChannelUtil.getId(ctx));
- CLIENT.put(envClientKey, ctx.channel());
- log.info("客户端 {} 注册成功", envClientKey);
- }
+ /**
+ * 客户端注册
+ *
+ * @param env 环境编码
+ * @param dataId 应用名称
+ * @param ctx 信道
+ */
+ public static void register(String env, String dataId, ChannelHandlerContext ctx) {
+ String envClientKey = String.format("%s_%s_%s", env, dataId, ChannelUtil.getId(ctx));
+ CLIENT.put(envClientKey, ctx.channel());
+ log.info("客户端 {} 注册成功", envClientKey);
+ }
- /**
- * 客户端注销
- *
- * @param channelId /
- */
- public static void unregister(ChannelId channelId) {
- List envClientKeys =
- CLIENT.keySet().stream()
- .filter(f -> f.endsWith(ChannelUtil.getId(channelId)))
- .collect(Collectors.toList());
- for (String envClientKey : envClientKeys) {
- Channel channel = CLIENT.getOrDefault(envClientKey, null);
- if (channel != null) {
- if (channel.isOpen()) {
- channel.closeFuture();
- }
- CLIENT.remove(envClientKey);
- log.info("客户端 {} 注销成功", envClientKey);
- }
+ /**
+ * 客户端注销
+ *
+ * @param channelId /
+ */
+ public static void unregister(ChannelId channelId) {
+ List envClientKeys =
+ CLIENT.keySet().stream()
+ .filter(f -> f.endsWith(ChannelUtil.getId(channelId)))
+ .collect(Collectors.toList());
+ for (String envClientKey : envClientKeys) {
+ Channel channel = CLIENT.getOrDefault(envClientKey, null);
+ if (channel != null) {
+ if (channel.isOpen()) {
+ channel.closeFuture();
}
+ CLIENT.remove(envClientKey);
+ log.info("客户端 {} 注销成功", envClientKey);
+ }
}
+ }
- /**
- * 根据env和dataId查询所有客户端节点
- *
- * @param env 环境编码
- * @param dataId 应用名称
- * @return /
- */
- public static List queryChannels(String env, String dataId) {
- String filterKey = String.format("%s_%s_", env, dataId);
- return CLIENT.entrySet().stream()
- .filter(f -> f.getKey().startsWith(filterKey))
- .map(Map.Entry::getValue)
- .collect(Collectors.toList());
- }
+ /**
+ * 根据env和dataId查询所有客户端节点
+ *
+ * @param env 环境编码
+ * @param dataId 应用名称
+ * @return /
+ */
+ public static List queryChannels(String env, String dataId) {
+ String filterKey = String.format("%s_%s_", env, dataId);
+ return CLIENT.entrySet().stream()
+ .filter(f -> f.getKey().startsWith(filterKey))
+ .map(Map.Entry::getValue)
+ .collect(Collectors.toList());
+ }
- /**
- * 根据channelId获取env和dataId
- *
- * @param channelId /
- * @return /
- */
- public static String[] getEnvDataId(ChannelId channelId) {
- String envClientKey =
- CLIENT.keySet().stream()
- .filter(f -> f.endsWith(ChannelUtil.getId(channelId)))
- .findFirst()
- .orElse(null);
- if (envClientKey == null) {
- throw new BadRequestException("获取配置数据ID失败");
- }
- String[] s = envClientKey.split("_");
- // 最大分割块数
- int maxSplitLength = 3;
- if (s.length != maxSplitLength) {
- throw new BadRequestException("获取配置数据ID失败");
- }
- return s;
+ /**
+ * 根据channelId获取env和dataId
+ *
+ * @param channelId /
+ * @return /
+ */
+ public static String[] getEnvDataId(ChannelId channelId) {
+ String envClientKey =
+ CLIENT.keySet().stream()
+ .filter(f -> f.endsWith(ChannelUtil.getId(channelId)))
+ .findFirst()
+ .orElse(null);
+ if (envClientKey == null) {
+ throw new BadRequestException("获取配置数据ID失败");
}
+ String[] s = envClientKey.split("_");
+ // 最大分割块数
+ int maxSplitLength = 3;
+ if (s.length != maxSplitLength) {
+ throw new BadRequestException("获取配置数据ID失败");
+ }
+ return s;
+ }
- public static Object queryClientInfos(ConfigApp.QueryClientArgs args) {
- String dataId = args.getDataId();
- String env = args.getEnv();
- return queryClientInfos(env, dataId);
- }
+ public static Object queryClientInfos(ConfigApp.QueryClientArgs args) {
+ String appName = args.getAppName();
+ String envCode = args.getEnvCode();
+ return queryClientInfos(envCode, appName);
+ }
}
diff --git a/kenaito-config-service/src/main/java/cn/odboy/service/impl/ConfigAppEnvServiceImpl.java b/kenaito-config-service/src/main/java/cn/odboy/service/impl/ConfigAppEnvServiceImpl.java
index 2a196dc..c9391fc 100644
--- a/kenaito-config-service/src/main/java/cn/odboy/service/impl/ConfigAppEnvServiceImpl.java
+++ b/kenaito-config-service/src/main/java/cn/odboy/service/impl/ConfigAppEnvServiceImpl.java
@@ -71,11 +71,7 @@ public class ConfigAppEnvServiceImpl extends ServiceImpl configFileId =
configFiles.stream().map(ConfigFile::getId).collect(Collectors.toList());
configFileService.removeBatchByIds(configFileId);
- Long fileId = configFileId.stream().findFirst().orElse(null);
- if (fileId != null) {
- // delete from config_version
- configVersionService.removeBatchByFileId(fileId);
- }
+ configFileId.stream().findFirst().ifPresent(configVersionService::removeBatchByFileId);
}
}
}
diff --git a/kenaito-config-service/src/main/java/cn/odboy/service/impl/ConfigFileServiceImpl.java b/kenaito-config-service/src/main/java/cn/odboy/service/impl/ConfigFileServiceImpl.java
index ebcfff1..89ad619 100644
--- a/kenaito-config-service/src/main/java/cn/odboy/service/impl/ConfigFileServiceImpl.java
+++ b/kenaito-config-service/src/main/java/cn/odboy/service/impl/ConfigFileServiceImpl.java
@@ -1,8 +1,11 @@
package cn.odboy.service.impl;
import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.io.IoUtil;
+import cn.hutool.core.stream.StreamUtil;
import cn.hutool.core.util.StrUtil;
import cn.odboy.config.model.msgtype.ConfigFileInfo;
+import cn.odboy.config.util.PropertiesUtil;
import cn.odboy.domain.ConfigFile;
import cn.odboy.domain.ConfigVersion;
import cn.odboy.infra.exception.BadRequestException;
@@ -14,10 +17,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
+import org.yaml.snakeyaml.Yaml;
/**
* 配置文件 服务实现类
@@ -117,6 +124,14 @@ public class ConfigFileServiceImpl extends ServiceImpl