Hello Team,

I have upgraded my application and below are details for same.

Previous Version- spring boot-1.5.6.RELEASE spring cloud version-Edgware.M1

Migrated Version- spring boot-2.4.4 spring cloud version-2020.0.2

Herein, after migration I am faced issue with Client Eureka Health Check handler sending status as up always even though one of dependency say DB is down. This happens only in case where we have 2 or more beans of same type supposing in my application I had 2 LDAP connections and out of which one was down. Ideally, Eureka Client Health Check Handler should have sent DOWN status to Eureka Server but when I debugged it was sending UP status. Moreover, same works fine if I only have 1 LDAP connection then if connection is DOWN it sends back correct status.

Moreover, if we hit actuator health endpoint then it shows correct status as down but Eureka Client Health Check Handler sends UP status back to Eureka Server. Additionally, we have enabled the eureka health check by specifying property in application properties - eureka.client.healthcheck.enabled=true.

It was working fine in previous version we were using even I observed this is working fine with Spring Boot-2.1.18.RELEASE version, post that issue is occurring.

One more observation is that in Spring Boot 2.4.4 we saw that if we have 2 beans of same type they are getting registered under HealthContributor bean whereas in versions till Spring Boot-2.1.18.RELEASE beans were registered under HealthIndicators bean.

I am attaching the jsons from Spring Boot -1.5.6.RELEASE, 2.4.4 version with one bean and multiple beans of same type. Here you would see that for LDAP if I say we have nested components the health status by Eureka client for same is being skipped and if we don't have nested components in LDAP bean or any other dependency then health check by Eureka client is being checked for them as well.

Note- I am referring to EurekaHealthCheckHandler present under spring-cloud-netflix-eureka-client jar. I am referring to health status being returned from this class back to Spring Cloud Netflix Eureka Server.

Spring_Boot-1 5 6 RELEASE_Working_Fine

Spring_Boot-2 4 4 RELEASE_Nested_Component_Issue

Spring_Boot-2 4 4_Single_Bean_Working_Fine_Issue

Comment From: kamaldesingh

Hello Team,

Kindly do assist on above request on priority.

Comment From: OlgaMaciaszek

Hello, @kamaldesingh, Spring Cloud 2020.x is no longer supported. Please upgrade to Spring Cloud 2021.x and Spring Boot 2.6.x. If the issue still persists, please provide a minimal, complete, verifiable example that reproduces the issue - we will verify it then. Also, please note that the issues are handled according to the team's issues backlog and priorities - we always look at all the reported issues, but it might take some time. To have your issue prioritised on top of our backlog, you may consider VMware Spring Runtime.

Comment From: kamaldesingh

Hello @OlgaMaciaszek , have tried using Spring Cloud 2021.0.1 with Spring Boot 2.6.3 version as well, still have same issue. Eureka Client is not considering nested components of application while sending the aggregate health status of application as explained above .

Comment From: OlgaMaciaszek

@kamaldesingh Please provide a minimal, complete, verifiable example that reproduces the issue.

Comment From: kamaldesingh

@OlgaMaciaszek - Below are couple of code snippet...one is property file having 2 ldap beans and other is pom.xml with the dependencies I am using in my project.

application.properties

spring.application.name=spring-boot-demo spring.datasource.url= spring.datasource.username= spring.datasource.password= spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect spring.datasource.initialize=false spring.jpa.hibernate.ddl-auto=update spring.jpa.generate-ddl=true primary.ldap.contextSource.url= primary.ldap.contextSource.base= primary.ldap.contextSource.userDn= primary.ldap.contextSource.password= primary.ldap.contextSource.pooled=true secondary.ldap.contextSource.base= secondary.ldap.contextSource.password= secondary.ldap.contextSource.pooled=true secondary.ldap.contextSource.url= secondary.ldap.contextSource.userDn= eureka.client.healthcheck.enabled=true

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.3</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>spring-boot-demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring-boot-demo</name>
    <description>Demo project for Spring Boot</description>
    <properties>
        <java.version>11</java.version>
        <spring-cloud.version>2021.0.1</spring-cloud.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-ldap</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>