Spring Cloud服务实例类配置详解

package org.springframework.cloud.netflix.eureka;

import com.netflix.appinfo.DataCenterInfo;
import com.netflix.appinfo.MyDataCenterInfo;
import com.netflix.appinfo.DataCenterInfo.Name;
import com.netflix.appinfo.InstanceInfo.InstanceStatus;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.cloud.commons.util.InetUtils.HostInfo;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;

@ConfigurationProperties("eureka.instance")
public class EurekaInstanceConfigBean implements CloudEurekaInstanceConfig, EnvironmentAware {
    private static final String UNKNOWN = "unknown";
    private HostInfo hostInfo;
    private InetUtils inetUtils;
    private String actuatorPrefix = "/actuator";
    //服务名,默认去spring.application.name的配置值
    private String appname = "unknown";
    private String appGroupName;
    private boolean instanceEnabledOnit;
    //非安全的通信端口号,默认80
    private int nonSecurePort = 80;
    //安全的通信端口号,默认443
    private int securePort = 443;
    //是否启用非安全的通信端口号,默认true
    private boolean nonSecurePortEnabled = true;
    //使用启用安全的通信端口号
    private boolean securePortEnabled;
    //Eureka客户端向服务端发送心跳的时间间隔,默认为30秒
    private int leaseRenewalIntervalInSeconds = 30;
    //Eureka服务端在收到最后一次心跳之后等到的时间上限,默认90秒。超过该时间之后服务端会将该服务实例从服务清单中剔除,从而禁止服务调用请求呗发送到该实例上
    private int leaseExpirationDurationInSeconds = 90;
    private String virtualHostName = "unknown";
    private String instanceId;
    private String secureVirtualHostName = "unknown";
    private String aSGName;
    //元数据:Eureka客户端在向服务注册中心发送注册请求时,用来描述自身服务信息得对象,其中包含了一些标准化的元数据,比如服务名称、实例名称、实例IP、实例端口等用于服务治理的终于信息,以及一些用于负载均衡策略或是其他特殊用途的自定义元数据信息。
    private Map<String, String> metadataMap = new HashMap();
    private DataCenterInfo dataCenterInfo;
    private String ipAddress;
    private String statusPageUrlPath;
    private String statusPageUrl;
    private String homePageUrlPath;
    private String homePageUrl;
    private String healthCheckUrlPath;
    private String healthCheckUrl;
    private String secureHealthCheckUrl;
    private String namespace;
    //主机名,不配置的时候将根据操作系统的主机名来获取
    private String hostname;
    //是否优先使用IP地址作为主机名的标识
    private boolean preferIpAddress;
    private InstanceStatus initialStatus;
    private String[] defaultAddressResolutionOrder;
    private Environment environment;
}

更多文章:
点击跳转CSDN博客
点击跳转简书博客
公众号:代码小搬运
代码小搬运.jpg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值