Excluding a composite health contributor by the composite name no longer works in spring boot 2.6. It worked previously in spring boot 2.5.

Potentially caused by #23027

Here is an example application, with a failing unit test... health-group-composite-test.zip

The excludefoo_endpoint_should_not_contain_foo_indicators test fails with spring-boot 2.6.2. If you change the application to use spring boot 2.5.8, the test will pass.

The application defines a composite health contributor named foo as follows:

    @Bean
    CompositeHealthContributor fooHealthContributor() {
        return CompositeHealthContributor.fromMap(Map.<String, HealthIndicator>of(
                "foo-1", () -> Health.up().build(),
                "foo-2", () -> Health.up().build()
                ));
    }

And then creates a health group named exclude-foo that excludes that contributor:

management:
  endpoint:
    health:
      show-details: always
      group:
        exclude-foo:
          include: "*"
          exclude: foo
          show-details: always

With spring boot 2.5.8, the exclude-foo group endpoint does not show the foo indicators (as expected)...

$ http :8080/actuator/health/exclude-foo
HTTP/1.1 200 OK
Content-Length: 169
Content-Type: application/vnd.spring-boot.actuator.v3+json

{
    "components": {
        "diskSpace": {
            "details": {
                "exists": true,
                "free": 644861575168,
                "threshold": 10485760,
                "total": 989547458560
            },
            "status": "UP"
        },
        "ping": {
            "status": "UP"
        }
    },
    "status": "UP"
}

With spring boot 2.6.2, the exclude-foo group endpoint shows the foo indicators (unexpected)...

$ http :8080/actuator/health/exclude-foo 
HTTP/1.1 200 OK
Content-Length: 254
Content-Type: application/vnd.spring-boot.actuator.v3+json

{
    "components": {
        "diskSpace": {
            "details": {
                "exists": true,
                "free": 644852699136,
                "threshold": 10485760,
                "total": 989547458560
            },
            "status": "UP"
        },
        "foo": {
            "components": {
                "foo-1": {
                    "status": "UP"
                },
                "foo-2": {
                    "status": "UP"
                }
            },
            "status": "UP"
        },
        "ping": {
            "status": "UP"
        }
    },
    "status": "UP"
}

Comment From: philwebb

Thanks for the sample @philsttr. I've hopefully fixed this for 2.6.3