Search code examples
spring-bootspring-cloudnetflix-eureka

Is eureka spring version independent?


For a project I am using Spring Eureka. It works great with Spring boot 1.5. I want to upgrade to Spring boot 2. I see that with Spring boot 2 the health endpoints have moved. Does eureka know how to handle this change?

Out of curiosity, when spring registers to eureka does it pass on what the health url is so that eureka knows where to contact the health url?


Solution

  • I did the spring boot version upgrade recently. Eureka works fine with spring boot 2.

    Does eureka know how to handle this change?

    Yes, based on below configuration it will look for the default /actuator/health endpoint.

    /**
     * Default prefix for actuator endpoints
     */
    private String actuatorPrefix = "/actuator";
    private String healthCheckUrlPath = actuatorPrefix + "/health";
    

    So, if we have actuator endpoint enable it tries to connect to the given endpoint for health check.

    when spring registers to eureka does it pass on what the health url is so that eureka knows where to contact the health url?

    Yes, we can provide the health check URLs while registering client to eureka server. In that case it will always do the health check from provided endpoint. Here goes the property we can use to set the same-

    eureka.instance.health-check-url-path= HEALTH_CHECK_URL_PATH
    

    OR,

    eureka:
      instance:
        healthCheckUrlPath: HEALTH_CHECK_URL