diff --git a/kenaito-config-core/src/main/java/cn/odboy/config/model/ConfigKv.java b/kenaito-config-common/src/main/java/cn/odboy/config/model/ConfigKv.java similarity index 100% rename from kenaito-config-core/src/main/java/cn/odboy/config/model/ConfigKv.java rename to kenaito-config-common/src/main/java/cn/odboy/config/model/ConfigKv.java diff --git a/kenaito-config-core/src/main/java/cn/odboy/config/util/ProtostuffUtil.java b/kenaito-config-common/src/main/java/cn/odboy/config/util/ProtostuffUtil.java similarity index 100% rename from kenaito-config-core/src/main/java/cn/odboy/config/util/ProtostuffUtil.java rename to kenaito-config-common/src/main/java/cn/odboy/config/util/ProtostuffUtil.java diff --git a/kenaito-config-core/pom.xml b/kenaito-config-core/pom.xml index db9d21c..4912d9c 100644 --- a/kenaito-config-core/pom.xml +++ b/kenaito-config-core/pom.xml @@ -18,6 +18,12 @@ 子模块-配置中心sdk + + cn.odboy + kenaito-config-common + 1.0 + + io.netty netty-all diff --git a/kenaito-config-service/pom.xml b/kenaito-config-service/pom.xml index c71e9fe..8b201cd 100644 --- a/kenaito-config-service/pom.xml +++ b/kenaito-config-service/pom.xml @@ -28,7 +28,7 @@ cn.odboy - kenaito-config-core + kenaito-config-common 1.0 diff --git a/kenaito-config-service/src/main/java/cn/odboy/AppRun.java b/kenaito-config-service/src/main/java/cn/odboy/KenaitoConfigServiceRun.java similarity index 86% rename from kenaito-config-service/src/main/java/cn/odboy/AppRun.java rename to kenaito-config-service/src/main/java/cn/odboy/KenaitoConfigServiceRun.java index 22bdb41..82891a6 100644 --- a/kenaito-config-service/src/main/java/cn/odboy/AppRun.java +++ b/kenaito-config-service/src/main/java/cn/odboy/KenaitoConfigServiceRun.java @@ -2,7 +2,6 @@ package cn.odboy; import cn.odboy.infra.context.EasyBootApplication; import cn.odboy.infra.context.SpringContextHolder; -import com.alibaba.fastjson.parser.ParserConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; @@ -12,14 +11,14 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @EnableAsync @SpringBootApplication @EnableTransactionManagement -public class AppRun extends EasyBootApplication { +public class KenaitoConfigServiceRun extends EasyBootApplication { @Bean public SpringContextHolder springContextHolder() { return new SpringContextHolder(); } public static void main(String[] args) { - SpringApplication springApplication = new SpringApplication(AppRun.class); + SpringApplication springApplication = new SpringApplication(KenaitoConfigServiceRun.class); initd(springApplication.run(args)); } } diff --git a/kenaito-config-service/src/main/java/cn/odboy/infra/netty/ConfigNettyServer.java b/kenaito-config-service/src/main/java/cn/odboy/infra/netty/ConfigNettyServer.java index 5f1aba1..d67be77 100644 --- a/kenaito-config-service/src/main/java/cn/odboy/infra/netty/ConfigNettyServer.java +++ b/kenaito-config-service/src/main/java/cn/odboy/infra/netty/ConfigNettyServer.java @@ -1,7 +1,6 @@ package cn.odboy.infra.netty; import cn.hutool.core.thread.ThreadUtil; -import cn.odboy.config.ConfigCenterProperties; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelInitializer; @@ -12,14 +11,14 @@ import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @Slf4j @Component public class ConfigNettyServer implements InitializingBean { - @Autowired - private ConfigCenterProperties properties; + @Value("${kenaito.config-center.port}") + private Integer configCenterPort; @Override public void afterPropertiesSet() throws Exception { @@ -48,7 +47,7 @@ public class ConfigNettyServer implements InitializingBean { } }); log.info("Netty Server Start..."); - ChannelFuture channelFuture = serverBootstrap.bind(properties.getPort()).sync(); + ChannelFuture channelFuture = serverBootstrap.bind(configCenterPort).sync(); channelFuture.channel().closeFuture().sync(); } finally { bossGroup.shutdownGracefully(); diff --git a/kenaito-config-service/src/main/resources/config/application-daily.yml b/kenaito-config-service/src/main/resources/config/application-daily.yml deleted file mode 100644 index 0116afc..0000000 --- a/kenaito-config-service/src/main/resources/config/application-daily.yml +++ /dev/null @@ -1,7 +0,0 @@ -kenaito: - config-center: - server: 127.0.0.1 - port: 28002 - data-id: kenaito-config-service - cache-dir: c:\\data - env: daily \ No newline at end of file diff --git a/kenaito-config-service/src/main/resources/config/application-dev.yml b/kenaito-config-service/src/main/resources/config/application-dev.yml index 4fb0909..2d35062 100644 --- a/kenaito-config-service/src/main/resources/config/application-dev.yml +++ b/kenaito-config-service/src/main/resources/config/application-dev.yml @@ -245,4 +245,7 @@ task: # 活跃时间 keep-alive-seconds: 60 # 队列容量 - queue-capacity: 50 \ No newline at end of file + queue-capacity: 50 +kenaito: + config-center: + port: 28002 \ No newline at end of file diff --git a/kenaito-config-service/src/main/resources/config/application-production.yml b/kenaito-config-service/src/main/resources/config/application-production.yml deleted file mode 100644 index f287a61..0000000 --- a/kenaito-config-service/src/main/resources/config/application-production.yml +++ /dev/null @@ -1,7 +0,0 @@ -kenaito: - config-center: - server: 127.0.0.1 - port: 28002 - data-id: kenaito-config-service - cache-dir: /home/admin/data - env: production \ No newline at end of file diff --git a/kenaito-config-service/src/main/resources/config/application-stage.yml b/kenaito-config-service/src/main/resources/config/application-stage.yml deleted file mode 100644 index 27d1273..0000000 --- a/kenaito-config-service/src/main/resources/config/application-stage.yml +++ /dev/null @@ -1,7 +0,0 @@ -kenaito: - config-center: - server: 127.0.0.1 - port: 28002 - data-id: kenaito-config-service - cache-dir: /home/admin/data - env: stage \ No newline at end of file diff --git a/kenaito-config-service/src/main/resources/config/application.yml b/kenaito-config-service/src/main/resources/config/application.yml index 7a1ea5c..cc7425d 100644 --- a/kenaito-config-service/src/main/resources/config/application.yml +++ b/kenaito-config-service/src/main/resources/config/application.yml @@ -1,4 +1,4 @@ spring: profiles: # 激活哪个配置文件, application-{active}.yml - active: daily + active: dev diff --git a/pom.xml b/pom.xml index fc894f0..96334a7 100644 --- a/pom.xml +++ b/pom.xml @@ -13,8 +13,10 @@ kenaito-common kenaito-tools kenaito-system + kenaito-config-common kenaito-config-core kenaito-config-service + kenaito-config-demo Kenaito Config