[fix] 添加配置spring.lazy.netty.enable 控制是否开启客户端默认是关闭的 需要手动开启

This commit is contained in:
wujiawei 2024-02-23 15:37:35 +08:00
parent 864583b169
commit ef6e95948d
5 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,4 @@
### 版本更新 ### 版本更新
#### 1.2.2-JDK17-SNAPSHOT #### 1.2.2-JDK17-SNAPSHOT
【fix】修正流量计算保存两位小数 【fix】修正流量计算保存两位小数
[fix] 添加配置spring.lazy.netty.enable 控制是否开启客户端默认是关闭的 需要手动开启

View File

@ -1,8 +1,11 @@
package wu.framework.lazy.cloud.heartbeat.client; package wu.framework.lazy.cloud.heartbeat.client;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import wu.framework.lazy.cloud.heartbeat.client.netty.config.NettyServerProperties;
@ConditionalOnProperty(prefix = NettyServerProperties.PREFIX, name = "enabled", havingValue = "true", matchIfMissing = true)
@ComponentScan(basePackages = "wu.framework.lazy.cloud.heartbeat.client") @ComponentScan(basePackages = "wu.framework.lazy.cloud.heartbeat.client")
public class EnableHeartbeatClientAutoConfiguration { public class EnableHeartbeatClientAutoConfiguration {
} }

View File

@ -3,6 +3,7 @@ package wu.framework.lazy.cloud.heartbeat.client.netty.config;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import wu.framework.lazy.cloud.heartbeat.client.application.ClientNettyConfigApplication; import wu.framework.lazy.cloud.heartbeat.client.application.ClientNettyConfigApplication;
@ -22,6 +23,7 @@ import java.util.concurrent.TimeUnit;
*/ */
@Slf4j @Slf4j
@Configuration @Configuration
@ConditionalOnProperty(prefix = NettyServerProperties.PREFIX, name = "enabled", havingValue = "true", matchIfMissing = true)
public class ClientAutoConfiguration implements CommandLineRunner { public class ClientAutoConfiguration implements CommandLineRunner {
private final NettyServerProperties nettyServerProperties; private final NettyServerProperties nettyServerProperties;

View File

@ -2,6 +2,7 @@ package wu.framework.lazy.cloud.heartbeat.client.netty.config;
import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Role; import org.springframework.context.annotation.Role;
import wu.framework.lazy.cloud.heartbeat.client.application.ClientNettyConfigApplication; import wu.framework.lazy.cloud.heartbeat.client.application.ClientNettyConfigApplication;
@ -11,6 +12,7 @@ import wu.framework.lazy.cloud.heartbeat.common.advanced.HandleChannelTypeAdvanc
import java.util.List; import java.util.List;
@Role(BeanDefinition.ROLE_INFRASTRUCTURE) @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@ConditionalOnProperty(prefix = NettyServerProperties.PREFIX, name = "enabled", havingValue = "true", matchIfMissing = true)
public class HeartbeatClientConfiguration { public class HeartbeatClientConfiguration {
/** /**

View File

@ -28,4 +28,8 @@ public class NettyServerProperties {
* 客户端ID * 客户端ID
*/ */
private String clientId = "1024"; private String clientId = "1024";
/**
* 是否开启 默认否
*/
private boolean enabled = false;
} }