mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2026-02-04 15:05:54 +08:00
[fix] 修改bean 手动注入
This commit is contained in:
@@ -6,7 +6,6 @@ import wu.framework.lazy.cloud.heartbeat.client.application.ClientNettyConfigApp
|
||||
import wu.framework.lazy.cloud.heartbeat.client.netty.socket.NettyClientSocket;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -23,9 +22,8 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class AutoConfiguration implements CommandLineRunner {
|
||||
public class ClientAutoConfiguration implements CommandLineRunner {
|
||||
|
||||
private final ServerProperties serverProperties;
|
||||
private final NettyServerProperties nettyServerProperties;
|
||||
private final ClientNettyConfigApplication clientNettyConfigApplication;
|
||||
|
||||
@@ -35,11 +33,9 @@ public class AutoConfiguration implements CommandLineRunner {
|
||||
ThreadPoolExecutor NETTY_CLIENT_EXECUTOR = new ThreadPoolExecutor(1, 1, 200, TimeUnit.MILLISECONDS,
|
||||
new ArrayBlockingQueue<>(1));
|
||||
|
||||
public AutoConfiguration(ServerProperties serverProperties,
|
||||
NettyServerProperties nettyServerProperties,
|
||||
ClientNettyConfigApplication clientNettyConfigApplication,
|
||||
List<ChannelTypeAdvanced> channelTypeAdvancedList) {
|
||||
this.serverProperties = serverProperties;
|
||||
public ClientAutoConfiguration(NettyServerProperties nettyServerProperties,
|
||||
ClientNettyConfigApplication clientNettyConfigApplication,
|
||||
List<ChannelTypeAdvanced> channelTypeAdvancedList) {
|
||||
this.nettyServerProperties = nettyServerProperties;
|
||||
this.clientNettyConfigApplication = clientNettyConfigApplication;
|
||||
this.channelTypeAdvancedList = channelTypeAdvancedList;
|
||||
@@ -47,7 +43,7 @@ public class AutoConfiguration implements CommandLineRunner {
|
||||
|
||||
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
public NettyClientSocket nettyServerSocket() {
|
||||
public NettyClientSocket nettyClientSocket() {
|
||||
String inetHost = nettyServerProperties.getInetHost();
|
||||
int inetPort = nettyServerProperties.getInetPort();
|
||||
String clientId = nettyServerProperties.getClientId();
|
||||
@@ -0,0 +1,66 @@
|
||||
package wu.framework.lazy.cloud.heartbeat.client.netty.config;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import wu.framework.lazy.cloud.heartbeat.client.application.ClientNettyConfigApplication;
|
||||
import wu.framework.lazy.cloud.heartbeat.client.netty.advanced.*;
|
||||
import wu.framework.lazy.cloud.heartbeat.client.netty.config.NettyServerProperties;
|
||||
import wu.framework.lazy.cloud.heartbeat.common.advanced.ChannelTypeAdvanced;
|
||||
|
||||
import java.util.List;
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
public class HeartbeatClientConfiguration {
|
||||
|
||||
/**
|
||||
* 服务端 处理客户端心跳
|
||||
*
|
||||
* @return ClientChannelHeartbeatTypeAdvanced
|
||||
*/
|
||||
@Bean
|
||||
public ClientChannelHeartbeatTypeAdvanced clientChannelHeartbeatTypeAdvanced() {
|
||||
return new ClientChannelHeartbeatTypeAdvanced();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理 客户端代理的真实端口自动读写
|
||||
* @return ClientDistributeSingleClientRealAutoReadConnectTypeAdvanced
|
||||
*/
|
||||
@Bean
|
||||
public ClientDistributeSingleClientRealAutoReadConnectTypeAdvanced clientDistributeSingleClientRealAutoReadConnectTypeAdvanced(){
|
||||
return new ClientDistributeSingleClientRealAutoReadConnectTypeAdvanced();
|
||||
}
|
||||
@Bean
|
||||
public ClientDistributeSingleClientRealCloseVisitorTypeAdvanced clientDistributeSingleClientRealCloseVisitorTypeAdvanced(){
|
||||
return new ClientDistributeSingleClientRealCloseVisitorTypeAdvanced();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientReportChannelTransferTypeAdvanced clientReportChannelTransferTypeAdvanced(NettyServerProperties nettyServerProperties){
|
||||
return new ClientReportChannelTransferTypeAdvanced(nettyServerProperties);
|
||||
}
|
||||
@Bean
|
||||
public DistributeConnectSuccessNotificationTypeAdvanced distributeConnectSuccessNotificationTypeAdvanced(ClientNettyConfigApplication clientNettyConfigApplication, NettyServerProperties nettyServerProperties){
|
||||
return new DistributeConnectSuccessNotificationTypeAdvanced(clientNettyConfigApplication, nettyServerProperties);
|
||||
}
|
||||
@Bean
|
||||
public DistributeDisconnectTypeAdvanced distributeDisconnectTypeAdvanced(ClientNettyConfigApplication clientNettyConfigApplication){
|
||||
return new DistributeDisconnectTypeAdvanced(clientNettyConfigApplication);
|
||||
}
|
||||
@Bean
|
||||
public DistributeStagingClosedTypeAdvanced distributeStagingClosedTypeAdvanced(){
|
||||
return new DistributeStagingClosedTypeAdvanced();
|
||||
}
|
||||
@Bean
|
||||
public DistributeStagingOpenedTypeAdvanced distributeStagingOpenedTypeAdvanced(){
|
||||
return new DistributeStagingOpenedTypeAdvanced();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public ClientDistributeSingleClientRealConnectTypeAdvanced clientDistributeSingleClientRealConnectTypeAdvanced(NettyServerProperties nettyServerProperties,
|
||||
List<ChannelTypeAdvanced> channelTypeAdvancedList ){
|
||||
return new ClientDistributeSingleClientRealConnectTypeAdvanced(nettyServerProperties,channelTypeAdvancedList);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,9 @@ import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 客户端访客通信通道 处理器
|
||||
*/
|
||||
@Slf4j
|
||||
public class NettyClientVisitorRealHandler extends SimpleChannelInboundHandler<NettyProxyMsg> {
|
||||
private final ChannelTypeAdapter channelTypeAdapter;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
# Auto Configure
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
wu.framework.lazy.cloud.heartbeat.client.EnableHeartbeatClientAutoConfiguration
|
||||
wu.framework.lazy.cloud.heartbeat.client.EnableHeartbeatClientAutoConfiguration,\
|
||||
wu.framework.lazy.cloud.heartbeat.client.netty.config.NettyServerProperties,\
|
||||
wu.framework.lazy.cloud.heartbeat.client.netty.config.ClientAutoConfiguration,\
|
||||
wu.framework.lazy.cloud.heartbeat.client.netty.config.HeartbeatClientConfiguration
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
wu.framework.lazy.cloud.heartbeat.client.EnableHeartbeatClientAutoConfiguration
|
||||
wu.framework.lazy.cloud.heartbeat.client.netty.config.NettyServerProperties
|
||||
wu.framework.lazy.cloud.heartbeat.client.netty.config.ClientAutoConfiguration
|
||||
wu.framework.lazy.cloud.heartbeat.client.netty.config.HeartbeatClientConfiguration
|
||||
|
||||
Reference in New Issue
Block a user