Reproducer can be found at mvitz/actuator-time-to-live.

If setting management.endpoint.health.cache.time-to-live to any value (e.g. 60s) if hitting the health-endpoint with a trailing slash (e.g. localhost:8080/actuator/health/ the cache is ignored and all health indicators are executed every time. To show that the reproducer contains a custom HealthIndicator that prints out a line every time it's invoked.

The Actuator documentation states within Configuring Endpoints:

Endpoints automatically cache responses to read operations that do not take any parameters.

I know that you could argue that calling /actuator/health/ is resulting in a call to a read operation with an empty parameter, but I was confused by this behaviour, and it did me take some time to figure out what's happening here and why my time to live was โ€œignoredโ€. In most cases, I, and I suspect others do too, expect that a URL that works with and without a trailing slash behaves the same.

Comment From: wilkinsona

This is expected and aligns with Framework's behavior around matching of trailing slashes. See https://github.com/spring-projects/spring-boot/issues/31563 for further background.