This commit is contained in:
骑着蜗牛追导弹 2024-12-03 23:12:15 +08:00
parent 9597bcc388
commit f531f4e1e9
12 changed files with 20 additions and 32 deletions

View File

@ -18,6 +18,12 @@
<name>子模块-配置中心sdk</name> <name>子模块-配置中心sdk</name>
<dependencies> <dependencies>
<dependency>
<groupId>cn.odboy</groupId>
<artifactId>kenaito-config-common</artifactId>
<version>1.0</version>
</dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-all</artifactId> <artifactId>netty-all</artifactId>

View File

@ -28,7 +28,7 @@
<dependency> <dependency>
<groupId>cn.odboy</groupId> <groupId>cn.odboy</groupId>
<artifactId>kenaito-config-core</artifactId> <artifactId>kenaito-config-common</artifactId>
<version>1.0</version> <version>1.0</version>
</dependency> </dependency>

View File

@ -2,7 +2,6 @@ package cn.odboy;
import cn.odboy.infra.context.EasyBootApplication; import cn.odboy.infra.context.EasyBootApplication;
import cn.odboy.infra.context.SpringContextHolder; import cn.odboy.infra.context.SpringContextHolder;
import com.alibaba.fastjson.parser.ParserConfig;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -12,14 +11,14 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableAsync @EnableAsync
@SpringBootApplication @SpringBootApplication
@EnableTransactionManagement @EnableTransactionManagement
public class AppRun extends EasyBootApplication { public class KenaitoConfigServiceRun extends EasyBootApplication {
@Bean @Bean
public SpringContextHolder springContextHolder() { public SpringContextHolder springContextHolder() {
return new SpringContextHolder(); return new SpringContextHolder();
} }
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication springApplication = new SpringApplication(AppRun.class); SpringApplication springApplication = new SpringApplication(KenaitoConfigServiceRun.class);
initd(springApplication.run(args)); initd(springApplication.run(args));
} }
} }

View File

@ -1,7 +1,6 @@
package cn.odboy.infra.netty; package cn.odboy.infra.netty;
import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.thread.ThreadUtil;
import cn.odboy.config.ConfigCenterProperties;
import io.netty.bootstrap.ServerBootstrap; import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelInitializer;
@ -12,14 +11,14 @@ import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean; 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; import org.springframework.stereotype.Component;
@Slf4j @Slf4j
@Component @Component
public class ConfigNettyServer implements InitializingBean { public class ConfigNettyServer implements InitializingBean {
@Autowired @Value("${kenaito.config-center.port}")
private ConfigCenterProperties properties; private Integer configCenterPort;
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
@ -48,7 +47,7 @@ public class ConfigNettyServer implements InitializingBean {
} }
}); });
log.info("Netty Server Start..."); log.info("Netty Server Start...");
ChannelFuture channelFuture = serverBootstrap.bind(properties.getPort()).sync(); ChannelFuture channelFuture = serverBootstrap.bind(configCenterPort).sync();
channelFuture.channel().closeFuture().sync(); channelFuture.channel().closeFuture().sync();
} finally { } finally {
bossGroup.shutdownGracefully(); bossGroup.shutdownGracefully();

View File

@ -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

View File

@ -245,4 +245,7 @@ task:
# 活跃时间 # 活跃时间
keep-alive-seconds: 60 keep-alive-seconds: 60
# 队列容量 # 队列容量
queue-capacity: 50 queue-capacity: 50
kenaito:
config-center:
port: 28002

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
spring: spring:
profiles: profiles:
# 激活哪个配置文件, application-{active}.yml # 激活哪个配置文件, application-{active}.yml
active: daily active: dev

View File

@ -13,8 +13,10 @@
<module>kenaito-common</module> <module>kenaito-common</module>
<module>kenaito-tools</module> <module>kenaito-tools</module>
<module>kenaito-system</module> <module>kenaito-system</module>
<module>kenaito-config-common</module>
<module>kenaito-config-core</module> <module>kenaito-config-core</module>
<module>kenaito-config-service</module> <module>kenaito-config-service</module>
<module>kenaito-config-demo</module>
</modules> </modules>
<name>Kenaito Config</name> <name>Kenaito Config</name>