Spring Cloud服务注册类配置参数注释

package org.springframework.cloud.netflix.eureka;

import com.netflix.appinfo.EurekaAccept;
import com.netflix.discovery.EurekaClientConfig;
import com.netflix.discovery.shared.transport.EurekaTransportConfig;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.core.env.PropertyResolver;
import org.springframework.util.StringUtils;

@ConfigurationProperties("eureka.client")
public class EurekaClientConfigBean implements EurekaClientConfig {
    public static final String PREFIX = "eureka.client";
    public static final String DEFAULT_URL = "http://localhost:8761/eureka/";
    public static final String DEFAULT_ZONE = "defaultZone";
    private static final int MINUTES = 60;
    @Autowired(
        required = false
    )
    PropertyResolver propertyResolver;
    //是否启用Eureka客户端,默认true
    private boolean enabled = true;
    @NestedConfigurationProperty
    private EurekaTransportConfig transport = new CloudEurekaTransportConfig();
    //从Eureka服务端获取注册信息得间隔时间,单位为秒
    private int registryFetchIntervalSeconds = 30;
    //更新实例信息的变化到Eureka服务端的间隔时间,单位为秒
    private int instanceInfoReplicationIntervalSeconds = 30;
    //初始化实例信息到Eureka服务端的间隔时间,单位为秒
    private int initialInstanceInfoReplicationIntervalSeconds = 40;
    //轮询Eureka服务端地址更改的间隔时间,单位为秒。当我们与Spring Cloud Config配合动态刷新Eureka的serviceURL地址时需要关注该参数
    private int eurekaServiceUrlPollIntervalSeconds = 300;
    private String proxyPort;
    private String proxyHost;
    private String proxyUserName;
    private String proxyPassword;
    //读取Eureka Server信息的超时时间,单位为秒
    private int eurekaServerReadTimeoutSeconds = 8;
    //连接Eureka Server的超时时间,单位为秒
    private int eurekaServerConnectTimeoutSeconds = 5;
    private String backupRegistryImpl;
    //从Eureka客户端到所有Eureka服务端的连接总数
    private int eurekaServerTotalConnections = 200;
    //从Eureka客户端到每个Eureka服务端主机的连接总数
    private int eurekaServerTotalConnectionsPerHost = 50;
    private String eurekaServerURLContext;
    private String eurekaServerPort;
    private String eurekaServerDNSName;
    private String region = "us-east-1";
    //Eureka服务端连接的空闲关闭时间,单位为秒
    private int eurekaConnectionIdleTimeoutSeconds = 30;
    private String registryRefreshSingleVipAddress;
    //心跳连接池的初始化线程数
    private int heartbeatExecutorThreadPoolSize = 2;
    //心跳超时重试延迟时间的最大乘数值
    private int heartbeatExecutorExponentialBackOffBound = 10;
	//缓存刷新线程池的初始化线程数
    private int cacheRefreshExecutorThreadPoolSize = 2;
    //缓存刷新重试延迟时间的最大乘数值
    private int cacheRefreshExecutorExponentialBackOffBound = 10;
    private Map<String, String> serviceUrl = new HashMap();
    private boolean gZipContent;
    //使用DNS来获取Eureka服务端的serviceUrl,默认false
    private boolean useDnsForFetchingServiceUrls;
    //是否要将自身的实例信息注册到Eureka服务端,默认true
    private boolean registerWithEureka;
    //是否偏好使用处于相同Zone的Eureka服务端,默认true
    private boolean preferSameZoneEureka;
    private boolean logDeltaDiff;
    private boolean disableDelta;
    private String fetchRemoteRegionsRegistry;
    private Map<String, String> availabilityZones;
    //获取实例时是否过滤,仅保留UP状态的实例,默认true
    private boolean filterOnlyUpInstances;
    //是否从Eureka服务端获取注册信息,默认true
    private boolean fetchRegistry;
    private String dollarReplacement;
    private String escapeCharReplacement;
    private boolean allowRedirects;
    private boolean onDemandUpdateStatusChange;
    private String encoderName;
    private String decoderName;
    private String clientDataAccept;
    private boolean shouldUnregisterOnShutdown;
    private boolean shouldEnforceRegistrationAtInit;

    public EurekaClientConfigBean() {
        this.serviceUrl.put("defaultZone", "http://localhost:8761/eureka/");
        this.gZipContent = true;
        this.useDnsForFetchingServiceUrls = false;
        this.registerWithEureka = true;
        this.preferSameZoneEureka = true;
        this.availabilityZones = new HashMap();
        this.filterOnlyUpInstances = true;
        this.fetchRegistry = true;
        this.dollarReplacement = "_-";
        this.escapeCharReplacement = "__";
        this.allowRedirects = false;
        this.onDemandUpdateStatusChange = true;
        this.clientDataAccept = EurekaAccept.full.name();
        this.shouldUnregisterOnShutdown = true;
        this.shouldEnforceRegistrationAtInit = false;
    }

    public boolean shouldGZipContent() {
        return this.gZipContent;
    }

    public boolean shouldUseDnsForFetchingServiceUrls() {
        return this.useDnsForFetchingServiceUrls;
    }

    public boolean shouldRegisterWithEureka() {
        return this.registerWithEureka;
    }

    public boolean shouldPreferSameZoneEureka() {
        return this.preferSameZoneEureka;
    }

    public boolean shouldLogDeltaDiff() {
        return this.logDeltaDiff;
    }

    public boolean shouldDisableDelta() {
        return this.disableDelta;
    }

    public boolean shouldUnregisterOnShutdown() {
        return this.shouldUnregisterOnShutdown;
    }

    public boolean shouldEnforceRegistrationAtInit() {
        return this.shouldEnforceRegistrationAtInit;
    }

    public String fetchRegistryForRemoteRegions() {
        return this.fetchRemoteRegionsRegistry;
    }

    public String[] getAvailabilityZones(String region) {
        String value = (String)this.availabilityZones.get(region);
        if (value =&
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值